From: Mika Laitio Date: Sat, 25 Dec 2010 23:06:33 +0000 (+0200) Subject: memory leak fix, for config file load case X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=009f188fe8cb6edbd9f0f2bb0308a2bcfbf3ca27;p=uci.git memory leak fix, for config file load case Signed-off-by: Mika Laitio --- diff --git a/file.c b/file.c index af42a37..8679841 100644 --- a/file.c +++ b/file.c @@ -808,7 +808,7 @@ static char **uci_list_config_files(struct uci_context *ctx) static struct uci_package *uci_file_load(struct uci_context *ctx, const char *name) { struct uci_package *package = NULL; - char *filename; + char *filename = NULL; bool confdir; FILE *file = NULL; @@ -845,8 +845,10 @@ static struct uci_package *uci_file_load(struct uci_context *ctx, const char *na done: uci_close_stream(file); - if (ctx->err) + if (ctx->err) { + free(filename); UCI_THROW(ctx, ctx->err); + } return package; }