From ca40d99f9a18687bde5a9662ba0ed6039780fe14 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Thu, 16 Feb 2012 15:39:04 +0000 Subject: [PATCH] Properly allocate callid mem when replacing hash entry. --- daemon/call.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 383a23bcc..d3bdcd2e2 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1135,7 +1135,7 @@ static void call_destroy(struct call *c) { c->prev->next = c->next; else if(c->next) /* we delete first element in list, so update callid hash */ - g_hash_table_replace(c->callmaster->callhash, c->callid, c->next); + g_hash_table_replace(c->callmaster->callhash, strdup(c->callid), c->next); #ifndef NO_REDIS /* TODO: take into account the viabranch list */ @@ -1462,8 +1462,6 @@ char *call_delete_udp(const char **out, struct callmaster *m) { c->callid, VIA2STR(c->viabranch)); call_destroy_all_branches(c); } else { - /* TODO: XXX: if "c" was first element, then update callhash table, because - we delete "c" here! */ mylog(LOG_INFO, "[%s - %s] Deleting selective call branch", c->callid, VIA2STR(c->viabranch)); call_destroy(c);