[Asterisk-code-review] res fax: Fix reference leak in fax v21 session new. (asterisk[11])

Corey Farrell asteriskteam at digium.com
Wed Jun 22 15:11:46 CDT 2016


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/3084

Change subject: res_fax: Fix reference leak in fax_v21_session_new.
......................................................................

res_fax: Fix reference leak in fax_v21_session_new.

fax_v21_session_new created a session details object but only released
the allocation reference during error conditions.  fax_session_new adds
it's own reference to details if needed so the caller is always
responsible for cleaning it's own reference.

ASTERISK-26141 #close

Change-Id: Ie7fc52a83b6596ce9ce2d5a2bd9f3e204f48fc88
---
M res/res_fax.c
1 file changed, 2 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/84/3084/1

diff --git a/res/res_fax.c b/res/res_fax.c
index 03a71b2..2f9d9ff 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -2554,11 +2554,8 @@
 	}
 
 	v21_details->caps = AST_FAX_TECH_V21_DETECT;
-	if (!(v21_session = fax_session_new(v21_details, chan, NULL, NULL))) {
-		ao2_ref(v21_details, -1);
-		return NULL;
-	}
-
+	v21_session = fax_session_new(v21_details, chan, NULL, NULL);
+	ao2_ref(v21_details, -1);
 	return v21_session;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/3084
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7fc52a83b6596ce9ce2d5a2bd9f3e204f48fc88
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list