Patchwork seabios: acpi: fix memory leak in build_srat().

login
register
mail settings
Submitter Isaku Yamahata
Date Feb. 12, 2010, 2:36 a.m.
Message ID <20100212023620.GD11930@valinux.co.jp>
Download mbox | patch
Permalink /patch/45175/
State New
Headers show

Comments

Isaku Yamahata - Feb. 12, 2010, 2:36 a.m.
numadata() is allocated for temporal use, but not freed.
free it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 src/acpi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Kevin O'Connor - Feb. 13, 2010, 11:08 p.m.
On Fri, Feb 12, 2010 at 11:36:20AM +0900, Isaku Yamahata wrote:
> numadata() is allocated for temporal use, but not freed.
> free it.

Thanks.

-Kevin

Patch

diff --git a/src/acpi.c b/src/acpi.c
index dbdca79..e2a1153 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -490,6 +490,7 @@  build_srat(void)
     srat = malloc_high(srat_size);
     if (!srat) {
         dprintf(1, "Not enough memory for srat table!\n");
+        free(numadata);
         return NULL;
     }
 
@@ -556,6 +557,7 @@  build_srat(void)
 
     build_header((void*)srat, SRAT_SIGNATURE, srat_size, 1);
 
+    free(numadata);
     return srat;
 }