From cea7c80bb2393142bba9922eeac2984b16aab8fa Mon Sep 17 00:00:00 2001 From: davidxu Date: Mon, 16 Aug 2004 05:20:12 +0000 Subject: Plug a memory leak in error case. --- lib/libthread_db/libpthread_db.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libthread_db') diff --git a/lib/libthread_db/libpthread_db.c b/lib/libthread_db/libpthread_db.c index c40b66a..603f30e 100644 --- a/lib/libthread_db/libpthread_db.c +++ b/lib/libthread_db/libpthread_db.c @@ -400,8 +400,10 @@ pt_ta_tsd_iter(const td_thragent_t *ta, td_key_iter_f *ki, void *arg) return (TD_MALLOC); ret = ps_pread(ta->ph, (psaddr_t)ta->thread_keytable_addr, keytable, ta->thread_max_keys * ta->thread_size_key); - if (ret != 0) + if (ret != 0) { + free(keytable); return (P2T(ret)); + } for (i = 0; i < ta->thread_max_keys; i++) { allocated = *(int *)(keytable + i * ta->thread_size_key + ta->thread_off_key_allocated); -- cgit v1.1