From: Lennart Poettering Date: Wed, 30 Oct 2013 17:15:38 +0000 (+0100) Subject: util: when we use path_strv_canonicalize() we must allocate the strv from the heap X-Git-Tag: v209~1706 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=8201ad81a033aff8526e489300e16c0011451330 util: when we use path_strv_canonicalize() we must allocate the strv from the heap --- diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c index 7ba4bee43..ed4070c66 100644 --- a/src/shared/conf-files.c +++ b/src/shared/conf-files.c @@ -148,12 +148,18 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char *root, con } int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...) { - char **dirs; + _cleanup_strv_free_ char **dirs = NULL; + va_list ap; assert(strv); assert(suffix); - dirs = strv_from_stdarg_alloca(dir); + va_start(ap, dir); + dirs = strv_new_ap(dir, ap); + va_end(ap); + + if (!dirs) + return -ENOMEM; return conf_files_list_strv_internal(strv, suffix, root, dirs); }