]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
fs/hfsplus: fix memory leak.
authorAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 27 Jan 2015 18:19:28 +0000 (21:19 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 27 Jan 2015 18:19:28 +0000 (21:19 +0300)
Found by: Coverity scan.

grub-core/fs/hfsplus.c

index 950d8a1e1c638fb7e58945db0a7dc2411de036b7..8f07f8544779fa276e8f6ccc060de5d2f638000e 100644 (file)
@@ -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;