libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH 3/6] Fix memory leak in ARM unw_create_addr_spa


From: Zachary T Welch
Subject: [Libunwind-devel] [PATCH 3/6] Fix memory leak in ARM unw_create_addr_space()
Date: Thu, 28 Oct 2010 16:25:48 -0700

Frees newly created address space memory in the event of a failure
caused by an endian mismatch.

Signed-off-by: Zachary T Welch <address@hidden>
---
 src/arm/Gcreate_addr_space.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/arm/Gcreate_addr_space.c b/src/arm/Gcreate_addr_space.c
index c3e1360..5374649 100644
--- a/src/arm/Gcreate_addr_space.c
+++ b/src/arm/Gcreate_addr_space.c
@@ -46,7 +46,10 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order)
    */
   if (byte_order != 0 && byte_order != __LITTLE_ENDIAN
       && byte_order != __BIG_ENDIAN)
-    return NULL;
+    {
+      free(as);
+      return NULL;
+    }
   
   /* Default to little-endian for ARM.  */
   if (byte_order == 0 || byte_order == __LITTLE_ENDIAN)
-- 
1.7.2.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]