X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fstrv.c;h=c5f8df06da6e8325b36dbbe0dec5b5dc54910fe4;hb=4fe60156fc45e34c7bcba4779123e15620532dff;hp=c8ff5745e82024bead8e6f997f1d1f0f4e0815b6;hpb=35b8ca3aaf8cb044ad76675dfcad89e000dd4a5c;p=elogind.git diff --git a/src/strv.c b/src/strv.c index c8ff5745e..c5f8df06d 100644 --- a/src/strv.c +++ b/src/strv.c @@ -78,9 +78,11 @@ char **strv_copy(char **l) { return r; fail: - for (k--, l--; k >= r; k--, l--) + for (k--; k >= r; k--) free(*k); + free(r); + return NULL; } @@ -435,6 +437,8 @@ char **strv_env_merge(unsigned n_lists, ...) { return r; fail: + va_end(ap); + for (k--; k >= r; k--) free(*k);