diff libfdcore/p_out.c @ 691:78b665400097

Cleanup all pthread_cleanup_push / pop pairs so that pop is always called after push, or ASSERT(0) is some grave errors
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 20 Jan 2011 19:44:27 +0900
parents 8c3dc8584dab
children 4ffbc9f1e922
line wrap: on
line diff
--- a/libfdcore/p_out.c	Thu Jan 20 15:38:12 2011 +0900
+++ b/libfdcore/p_out.c	Thu Jan 20 19:44:27 2011 +0900
@@ -68,13 +68,18 @@
 	
 	/* Save a request before sending so that there is no race condition with the answer */
 	if (msg_is_a_req) {
-		CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), { free(buf); return ret; } );
+		CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), goto out );
 	}
 	
 	/* Send the message */
-	CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, flags), { free(buf); return ret; } );
+	CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, flags), );
+out:
+	;	
 	pthread_cleanup_pop(1);
 	
+	if (ret)
+		return ret;
+	
 	/* Free remaining messages (i.e. answers) */
 	if (*msg) {
 		CHECK_FCT( fd_msg_free(*msg) );
"Welcome to our mercurial repository"