1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-26 03:11:44 +02:00

(unw_create_addr_space): Fix address-leak that triggered when function

was called with an unsupported "byte_order".

Signed-off-by: David Mosberger-Tang <dmosberger@gmail.com>
This commit is contained in:
Andreas Schwab 2007-06-06 20:55:36 -06:00 committed by David Mosberger-Tang
parent bde67706ed
commit 09c8c7d0f3

View file

@ -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);