[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] Memory leak in unw_create_addr_space
From: |
Andreas Schwab |
Subject: |
[Libunwind-devel] Memory leak in unw_create_addr_space |
Date: |
Wed, 06 Jun 2007 14:36:15 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux) |
This patch fixes a memory leak in unw_create_addr_space.
Andreas.
diff --git a/src/ia64/Gcreate_addr_space.c b/src/ia64/Gcreate_addr_space.c
index 6178cbf..a3524a0 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);
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
- [Libunwind-devel] Memory leak in unw_create_addr_space,
Andreas Schwab <=