Mercurial > hg > freeDiameter
changeset 293:ec67c5096eeb
Fix small issue with access to freed memory
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Mon, 10 May 2010 14:43:06 +0900 |
parents | a77ed0e30ac9 |
children | 0e940240c436 |
files | libfreeDiameter/sessions.c |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libfreeDiameter/sessions.c Mon May 10 14:26:42 2010 +0900 +++ b/libfreeDiameter/sessions.c Mon May 10 14:43:06 2010 +0900 @@ -590,16 +590,18 @@ int fd_sess_reclaim ( struct session ** session ) { struct session * sess; + uint32_t hash; TRACE_ENTRY("%p", session); CHECK_PARAMS( session && VALIDATE_SI(*session) ); sess = *session; + hash = sess->hash; *session = NULL; - CHECK_FCT( pthread_mutex_lock( H_LOCK(sess->hash) ) ); + CHECK_POSIX( pthread_mutex_lock( H_LOCK(sess->hash) ) ); pthread_cleanup_push( fd_cleanup_mutex, H_LOCK(sess->hash) ); - CHECK_FCT( pthread_mutex_lock( &exp_lock ) ); + CHECK_POSIX( pthread_mutex_lock( &exp_lock ) ); if (FD_IS_LIST_EMPTY(&sess->states)) { fd_list_unlink( &sess->chain_h ); fd_list_unlink( &sess->expire ); @@ -607,9 +609,9 @@ free(sess->sid); free(sess); } - CHECK_FCT( pthread_mutex_unlock( &exp_lock ) ); + CHECK_POSIX( pthread_mutex_unlock( &exp_lock ) ); pthread_cleanup_pop(0); - CHECK_FCT( pthread_mutex_unlock( H_LOCK(sess->hash) ) ); + CHECK_POSIX( pthread_mutex_unlock( H_LOCK(hash) ) ); return 0; }