From 8ee79c72b2a6ad5971895bc3a95e633211962107 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Wed, 3 Jan 2018 09:30:12 +0200 Subject: apk, del: fix few memory leaks This fixes couple of valgrind reported leaks - though they are non-important since the leak happens on "exit" only and kernel frees it anyway. --- src/apk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/apk.c') diff --git a/src/apk.c b/src/apk.c index 6cd4a5a..0abc7cc 100644 --- a/src/apk.c +++ b/src/apk.c @@ -460,6 +460,7 @@ int main(int argc, char **argv) const struct apk_option_group **optgroups = default_optgroups; struct apk_string_array *args; + apk_string_array_init(&args); #ifdef TEST_MODE apk_string_array_init(&test_repos); #endif @@ -585,7 +586,6 @@ int main(int argc, char **argv) } #endif - apk_string_array_init(&args); apk_string_array_resize(&args, argc); memcpy(args->item, argv, argc * sizeof(*argv)); @@ -602,5 +602,8 @@ err: free(ctx); fetchConnectionCacheClose(); + apk_string_array_free(&args); + free(apk_argv); + return r; } -- cgit v1.2.3-70-g09d2