From: Andrei Borzenkov Date: Tue, 27 Jan 2015 18:19:28 +0000 (+0300) Subject: fs/hfsplus: fix memory leak. X-Git-Tag: 2.02-beta3~457 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edc94e4b0bd026bf08861a4f4010a36bec0775cd;p=thirdparty%2Fgrub.git fs/hfsplus: fix memory leak. Found by: Coverity scan. --- diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index 950d8a1e1..8f07f8544 100644 --- a/grub-core/fs/hfsplus.c +++ b/grub-core/fs/hfsplus.c @@ -723,7 +723,10 @@ list_nodes (void *record, void *hook_arg) /* If the name is obviously invalid, skip this node. */ if (catkey->name[i] == 0) - return 0; + { + grub_free (filename); + return 0; + } } *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, @@ -745,7 +748,10 @@ list_nodes (void *record, void *hook_arg) callback function. */ node = grub_malloc (sizeof (*node)); if (!node) - return 1; + { + grub_free (filename); + return 1; + } node->data = ctx->dir->data; node->compressed = 0; node->cbuf = 0;