Skip to content

Commit 50680b2

Browse files
committed
Also destroy messages when its call is destroyed
1 parent 25068a2 commit 50680b2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/sip.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,16 @@ sip_call_create(char *callid)
191191
void
192192
sip_call_destroy(sip_call_t *call)
193193
{
194-
sip_call_t *prev = NULL;
195-
sip_msg_t *msg = NULL;
196-
197194
// No call to destroy
198195
if (!call) return;
199196

200-
// Get previous message
201-
//for (msg = call->msgs; msg; msg = msg->next)
202-
// sip_msg_destroy(msg);
197+
// Remove all messages
198+
while(call->msgs)
199+
sip_msg_destroy(call->msgs);
203200

204201
// Free it!
205202
free(call);
203+
call = NULL;
206204
}
207205

208206

0 commit comments

Comments
 (0)