]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix memory leaks in ofnet.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Apr 2013 18:12:11 +0000 (20:12 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Apr 2013 18:12:11 +0000 (20:12 +0200)
Reported by: Francesco Lavra.

ChangeLog
grub-core/net/drivers/ieee1275/ofnet.c

index a96511762c90473fac4b2c59c0d5688329b5e674..0514e735c78793206fc8a142d5e8a1f05bfc0ce5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-13  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Fix memory leaks in ofnet.
+       Reported by: Francesco Lavra.
+
 2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * docs/man/grub-glue-efi.h2m: Add missing file.
index cd9b159c78141f925601278dfbd224d4b4a6ff97..21b62141a5362cd8a3ea7558f26f0156adb22d26 100644 (file)
@@ -97,10 +97,7 @@ get_card_packet (struct grub_net_card *dev)
 
   nb = grub_netbuff_alloc (dev->mtu + 64 + 2);
   if (!nb)
-    {
-      grub_netbuff_free (nb);
-      return NULL;
-    }
+    return NULL;
   /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
      by 4. So that IP header is aligned on 4 bytes. */
   grub_netbuff_reserve (nb, 2);
@@ -281,6 +278,9 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
     card->txbuf = grub_zalloc (card->txbufsize);
   if (!card->txbuf)
     {
+      grub_free (ofdata->path);
+      grub_free (ofdata);
+      grub_free (card);
       grub_print_error ();
       return 0;
     }