[Asterisk-cvs] asterisk/channels chan_sip.c,1.818,1.819

kpfleming kpfleming
Wed Aug 24 22:31:31 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv27475/channels

Modified Files:
	chan_sip.c 
Log Message:
ensure Asterisk won't segfault during re-registration (issue #5011)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.818
retrieving revision 1.819
diff -u -d -r1.818 -r1.819
--- chan_sip.c	25 Aug 2005 02:25:29 -0000	1.818
+++ chan_sip.c	25 Aug 2005 02:33:21 -0000	1.819
@@ -1017,7 +1017,7 @@
 	struct sip_history *hist, *prev;
 	char *c;
 
-	if (!recordhistory)
+	if (!recordhistory || !p)
 		return 0;
 	if(!(hist = malloc(sizeof(struct sip_history)))) {
 		ast_log(LOG_WARNING, "Can't allocate memory for history");
@@ -4747,7 +4747,7 @@
 	if (!r)
 		return 0;
 
-	if (recordhistory) {
+	if (r->call && recordhistory) {
 		char tmp[80];
 		snprintf(tmp, sizeof(tmp), "Account: %s@%s", r->username, r->hostname);
 		append_history(r->call, "RegistryRenew", tmp);
@@ -4759,7 +4759,7 @@
 
 	r->expire = -1;
 	__sip_do_register(r);
-	ASTOBJ_UNREF(r,sip_registry_destroy);
+	ASTOBJ_UNREF(r, sip_registry_destroy);
 	return 0;
 }
 
@@ -4767,7 +4767,8 @@
 static int __sip_do_register(struct sip_registry *r)
 {
 	int res;
-	res=transmit_register(r, SIP_REGISTER, NULL, NULL);
+
+	res = transmit_register(r, SIP_REGISTER, NULL, NULL);
 	return res;
 }
 




More information about the svn-commits mailing list