Module: sip-router Branch: master Commit: 71dd754818d8c3ec304298f1002a45889c2da0aa URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=71dd754818d8c3ec304298f1002a45889c2da0aa
Author: Timo Reimann <[email protected]> Committer: Timo Reimann <[email protected]> Date: Sat Aug 27 01:32:49 2011 +0200 modules_k/dialog: Improve error handling during dialog creation. - Set current dialog only after all other setup work succeeded. (Eliminates call to profile_cleanup() and guarantees that dialog profiling does not yield to segfault if dialog creation fails for certain reasons.) - During error handling, refrain from decrementing the reference counter for dialog linking if this is a spiraled request (because positive spiral detection skips the linkage code path). --- modules_k/dialog/dlg_handlers.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c index 4951515..a5eb007 100644 --- a/modules_k/dialog/dlg_handlers.c +++ b/modules_k/dialog/dlg_handlers.c @@ -846,11 +846,6 @@ int dlg_new_dialog(struct sip_msg *req, struct cell *t, const int run_initial_cb if_update_stat( dlg_enable_stats, processed_dlgs, 1); finish: - - set_current_dialog(req, dlg); - _dlg_ctx.dlg = dlg; - ref_dlg(dlg, 1); - if (t) { // transaction exists ==> keep ref counter large enough to // avoid premature cleanup and ensure proper dialog referencing @@ -870,10 +865,15 @@ finish: } } + set_current_dialog(req, dlg); + _dlg_ctx.dlg = dlg; + ref_dlg(dlg, 1); + return 0; + error: - unref_dlg(dlg,1); // undo ref regarding linking - profile_cleanup(req, 0, NULL); // undo ref regarding setting current dialog + if (!spiral_detected) + unref_dlg(dlg,1); // undo ref regarding linking return -1; } _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
