]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix few memory leaks. Reported by Francesco Lavra
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Apr 2013 18:07:37 +0000 (20:07 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 13 Apr 2013 18:07:37 +0000 (20:07 +0200)
grub-core/net/drivers/uboot/ubootnet.c

index c0454f429b816caf1617a30b29e8405a20b2cb3e..2b743f4459c6c2315de223f907edbcf10c720606 100644 (file)
@@ -84,10 +84,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);
@@ -161,6 +158,8 @@ GRUB_MOD_INIT (ubootnet)
       card->txbuf = grub_zalloc (card->txbufsize);
       if (!card->txbuf)
        {
+         grub_free (ubdata);
+         grub_free (card);
          grub_print_error ();
          continue;
        }