Skip to content

Commit 6811373

Browse files
committed
fix memleak and address reply resume route being reloaded
1 parent dd79818 commit 6811373

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

modules/tm/async.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,15 @@ int t_resume_async_reply(int fd, void*param, int was_timeout)
320320
LOCK_REPLIES(t);
321321

322322
/* run the resume_route (some type as the original one) */
323-
swap_route_type(route, ctx->route_type);
324-
/* do not run any post script callback, we are a reply */
325-
run_resume_route( ctx->resume_route, ctx->reply, 0);
326-
set_route_type(route);
323+
if (!ref_script_route_check_and_update(ctx->resume_route)) {
324+
LM_ERR("resume route [%s] not present in cfg anymore\n",
325+
ctx->resume_route->name.s);
326+
} else {
327+
swap_route_type(route, ctx->route_type);
328+
/* do not run any post script callback, we are a reply */
329+
run_resume_route( ctx->resume_route, ctx->reply, 0);
330+
set_route_type(route);
331+
}
327332

328333
/* DO TM suspended actions to decide if we need to relay */
329334
if (!onreply_avp_mode)
@@ -349,6 +354,8 @@ int t_resume_async_reply(int fd, void*param, int was_timeout)
349354
clean_msg_clone(ctx->reply,ctx->reply,ctx->reply+ctx->reply_length);
350355
/* and free the message and context */
351356
free_cloned_msg(ctx->reply);
357+
if (ctx->resume_route)
358+
shm_free(ctx->resume_route);
352359
shm_free(ctx);
353360

354361
/* free also the processing ctx if still set

0 commit comments

Comments
 (0)