mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-06 23:02:55 -07:00
ensure Asterisk won't segfault during re-registration (issue #5011)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6402 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
+5
-4
@@ -1017,7 +1017,7 @@ static int append_history(struct sip_pvt *p, char *event, char *data)
|
||||
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 @@ static int sip_reregister(void *data)
|
||||
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 @@ static int sip_reregister(void *data)
|
||||
|
||||
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_reregister(void *data)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user