From 09c8c7d0f3f3cecb43c1292e1792dff1ebb28992 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 6 Jun 2007 20:55:36 -0600 Subject: [PATCH 1/2] (unw_create_addr_space): Fix address-leak that triggered when function was called with an unsupported "byte_order". Signed-off-by: David Mosberger-Tang --- src/ia64/Gcreate_addr_space.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ia64/Gcreate_addr_space.c b/src/ia64/Gcreate_addr_space.c index 6178cbf3..a3524a0a 100644 --- a/src/ia64/Gcreate_addr_space.c +++ b/src/ia64/Gcreate_addr_space.c @@ -33,14 +33,7 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order) #ifdef UNW_LOCAL_ONLY return NULL; #else - unw_addr_space_t as = malloc (sizeof (*as)); - - if (!as) - return NULL; - - memset (as, 0, sizeof (*as)); - - as->acc = *a; + unw_addr_space_t as; /* * IA-64 supports only big or little-endian, not weird stuff like @@ -51,6 +44,15 @@ unw_create_addr_space (unw_accessors_t *a, int byte_order) && byte_order != __BIG_ENDIAN) return NULL; + as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + if (byte_order == 0) /* use host default: */ as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); From 899ffbaa394138741d92c3aa0f1c4bf954ac9409 Mon Sep 17 00:00:00 2001 From: David Mosberger-Tang Date: Wed, 6 Jun 2007 20:58:25 -0600 Subject: [PATCH 2/2] Update NEWS file. --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index a62d2b55..45953fac 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ -*-Mode: outline-*- +* News for v0.98.6: + +** Fix address-leak triggered by invalid byte-order. Fixed by Andreas Schwab. + * News for v0.98.5: ** Fix a typo in the man-page of unw_create_addr_space().