changeset 785:e780452c6b55

Fix possible memory leaks
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 03 Apr 2012 08:21:06 +0200
parents e87d083d0342
children d3fc443dae36
files libfdproto/sessions.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libfdproto/sessions.c	Thu Mar 29 21:19:33 2012 +0200
+++ b/libfdproto/sessions.c	Tue Apr 03 08:21:06 2012 +0200
@@ -455,11 +455,13 @@
 		CHECK_MALLOC_DO(sess = new_session(sid, sidlen, hash),
 			{
 				ret = ENOMEM;
+				free(sid);
 				goto out;
 			} );
 	
 		fd_list_insert_before(li, &sess->chain_h); /* hash table */
 	} else {
+		free(sid);
 		/* it was found: was it previously destroyed? */
 		if ((*session)->is_destroyed == 0) {
 			ret = EALREADY;
"Welcome to our mercurial repository"