nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0300-Fix-memory-leaks-in-ofnet.patch

f96e0b
From 9435e9e0e5371624d0c3044e8ce7383b069717c3 Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Sat, 13 Apr 2013 20:12:11 +0200
f96e0b
Subject: [PATCH 300/482] 	Fix memory leaks in ofnet. 	Reported by:
f96e0b
 Francesco Lavra.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                              | 5 +++++
f96e0b
 grub-core/net/drivers/ieee1275/ofnet.c | 8 ++++----
f96e0b
 2 files changed, 9 insertions(+), 4 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index a965117..0514e73 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,3 +1,8 @@
f96e0b
+2013-04-13  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
+	Fix memory leaks in ofnet.
f96e0b
+	Reported by: Francesco Lavra.
f96e0b
+
f96e0b
 2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
 	* docs/man/grub-glue-efi.h2m: Add missing file.
f96e0b
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
f96e0b
index cd9b159..21b6214 100644
f96e0b
--- a/grub-core/net/drivers/ieee1275/ofnet.c
f96e0b
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
f96e0b
@@ -97,10 +97,7 @@ get_card_packet (struct grub_net_card *dev)
f96e0b
 
f96e0b
   nb = grub_netbuff_alloc (dev->mtu + 64 + 2);
f96e0b
   if (!nb)
f96e0b
-    {
f96e0b
-      grub_netbuff_free (nb);
f96e0b
-      return NULL;
f96e0b
-    }
f96e0b
+    return NULL;
f96e0b
   /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
f96e0b
      by 4. So that IP header is aligned on 4 bytes. */
f96e0b
   grub_netbuff_reserve (nb, 2);
f96e0b
@@ -281,6 +278,9 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
f96e0b
     card->txbuf = grub_zalloc (card->txbufsize);
f96e0b
   if (!card->txbuf)
f96e0b
     {
f96e0b
+      grub_free (ofdata->path);
f96e0b
+      grub_free (ofdata);
f96e0b
+      grub_free (card);
f96e0b
       grub_print_error ();
f96e0b
       return 0;
f96e0b
     }
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b