From: Felix Fietkau Date: Thu, 24 Oct 2013 21:24:32 +0000 (+0200) Subject: file: fix memleak on mktemp() errors X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=376fdc74c7207292ac9cc71c64f67a66bfd0cbfa;p=oweals%2Fuci.git file: fix memleak on mktemp() errors Signed-off-by: Felix Fietkau --- diff --git a/file.c b/file.c index 509ed73..44b2e02 100644 --- a/file.c +++ b/file.c @@ -703,8 +703,10 @@ static void uci_file_commit(struct uci_context *ctx, struct uci_package **packag UCI_THROW(ctx, UCI_ERR_MEM); mktemp(filename); - if (!*filename) + if (!*filename) { + free(filename); UCI_THROW(ctx, UCI_ERR_IO); + } if ((stat(filename, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) != S_IFREG)) UCI_THROW(ctx, UCI_ERR_IO);