From cf6a99879604a159c294206dae100aa12fc92047 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Thu, 28 Oct 2010 16:25:48 -0700 Subject: [PATCH] Fix memory leak in ARM unw_create_addr_space() Frees newly created address space memory in the event of a failure caused by an endian mismatch. Signed-off-by: Zachary T Welch --- src/arm/Gcreate_addr_space.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/arm/Gcreate_addr_space.c b/src/arm/Gcreate_addr_space.c index c3e1360f..53746491 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)