make sure call_destroy unrefs the correct call object

avoids a possible race condition with rapid create/delete/create of the
same call

Change-Id: I293c7064ea0c491b4040eb41300c56384c325719
changes/97/9997/1
Richard Fuchs 9 years ago
parent 040d1bec10
commit 97183b10df

@ -1912,10 +1912,12 @@ void call_destroy(struct call *c) {
p = m->poller;
rwlock_lock_w(&m->hashlock);
ret = g_hash_table_remove(m->callhash, &c->callid);
ret = (g_hash_table_lookup(m->callhash, &c->callid) == c);
if (ret)
g_hash_table_remove(m->callhash, &c->callid);
rwlock_unlock_w(&m->hashlock);
// if call not found in hashlock => previously deleted
// if call not found in callhash => previously deleted
if (!ret)
return;

Loading…
Cancel
Save