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

Signed-off-by: Zachary T Welch <[email protected]>
---
 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


_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to