diff extensions/app_test/atst_cli.c @ 99:bc07ebb58e98

Fix segfault
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 08 Dec 2009 11:15:02 +0900
parents d5951258be1b
children
line wrap: on
line diff
--- a/extensions/app_test/atst_cli.c	Tue Dec 08 11:10:17 2009 +0900
+++ b/extensions/app_test/atst_cli.c	Tue Dec 08 11:15:02 2009 +0900
@@ -140,7 +140,7 @@
 	struct msg * req = NULL;
 	struct avp * avp;
 	union avp_value val;
-	struct atst_mess_info * mi = NULL;
+	struct atst_mess_info * mi = NULL, *svg;
 	struct session *sess = NULL;
 	
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
@@ -206,15 +206,18 @@
 	
 	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
 	
+	/* Keep a pointer to the session data for debug purpose, in real life we would not need it */
+	svg = mi;
+	
 	/* Store this value in the session */
 	CHECK_FCT_DO( fd_sess_state_store ( atst_cli_reg, sess, &mi ), goto out ); 
 	
 	/* Log sending the message */
-	fprintf(stderr, "SEND %x to '%s' (%s)\n", mi->randval, atst_conf->dest_realm, atst_conf->dest_host?:"-" );
+	fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, atst_conf->dest_realm, atst_conf->dest_host?:"-" );
 	fflush(stderr);
 	
 	/* Send the request */
-	CHECK_FCT_DO( fd_msg_send( &req, atst_cb_ans, mi ), goto out );
+	CHECK_FCT_DO( fd_msg_send( &req, atst_cb_ans, svg ), goto out );
 
 out:
 	TRACE_DEBUG(FULL, "Client function terminated");	
"Welcome to our mercurial repository"