Skip to content

Commit a3f84d5

Browse files
committed
Fix freeing processing context after a second async jump.
If thw processing ctx was stored back into transaction (due a new async call), do not free the current ctx (as it became NULL). Reported by Minh PHAN (@qmphan). Closes OpenSIPS#780 . (cherry picked from commit 031304a)
1 parent eb586ee commit a3f84d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/tm/async.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,14 @@ int t_resume_async(int fd, void *param)
142142
/* no need for the context anymore */
143143
shm_free(ctx);
144144

145-
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
146-
pkg_free(current_processing_ctx);
145+
/* free also the processing ctx if still set
146+
* NOTE: it may become null if inside the run_resume_route
147+
* another async jump was made (and context attached again
148+
* to transaction) */
149+
if (current_processing_ctx) {
150+
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
151+
pkg_free(current_processing_ctx);
152+
}
147153

148154
restore:
149155
/* restore original environment */

0 commit comments

Comments
 (0)