Skip to content

Commit

Permalink
run destroy context when the message is sent
Browse files Browse the repository at this point in the history
Credits go to 46Labs for discovering and providing test scenarios
  • Loading branch information
razvancrainea committed Oct 29, 2015
1 parent 48b88bd commit 28bcadf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/tm/async.c
Expand Up @@ -138,6 +138,7 @@ int t_resume_async(int fd, void *param)
bind_address = backup_si;

free_faked_req( &faked_req, t);
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
current_processing_ctx = NULL;

return 0;
Expand Down
10 changes: 8 additions & 2 deletions receive.c
Expand Up @@ -200,8 +200,6 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
if (rc & SCB_RUN_POST_CBS)
exec_post_req_cb(msg);

context_destroy(CONTEXT_GLOBAL, ctx);

} else if (msg->first_line.type==SIP_REPLY) {
update_stat( rcv_rpls, 1);
/* sanity checks */
Expand Down Expand Up @@ -252,6 +250,14 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
}

end:

/* if someone else set the context, then we should also "release" the
* static ctx. */
if (current_processing_ctx == NULL)
ctx = NULL;
else
context_destroy(CONTEXT_GLOBAL, ctx);

current_processing_ctx = NULL;
stop_expire_timer( start, execmsgthreshold, "msg processing",
msg->buf, msg->len, 0);
Expand Down

0 comments on commit 28bcadf

Please sign in to comment.