[Asterisk-code-review] res pjsip session: segfault on already disconnected session (asterisk[13])
George Joseph
asteriskteam at digium.com
Thu Sep 1 10:38:56 CDT 2016
George Joseph has posted comments on this change.
Change subject: res_pjsip_session: segfault on already disconnected session
......................................................................
Patch Set 7: Code-Review-1
(1 comment)
https://gerrit.asterisk.org/#/c/3514/7/res/res_pjsip_session.c
File res/res_pjsip_session.c:
PS7, Line 2095: if (invite->session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
: ast_log(LOG_ERROR, "Session already DISCONNECTED [reason=%d (%s)]\n",
: invite->session->inv_session->cause,
: pjsip_get_status_text(invite->session->inv_session->cause)->ptr);
: goto end;
: }
:
: #ifdef HAVE_PJSIP_INV_SESSION_REF
: if (pjsip_inv_add_ref(invite->session->inv_session) != PJ_SUCCESS) {
: ast_log(LOG_ERROR, "Can't increase the session reference counter\n");
: goto end;
: }
: #endif
Since these are actually error conditions, you should return a non zero and have the caller handle the error.
you probably don't want to "goto end" and attempt a decrement when you haven't incremented the reference.
--
To view, visit https://gerrit.asterisk.org/3514
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7
Gerrit-PatchSet: 7
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list