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

Corey Farrell asteriskteam at digium.com
Wed Jun 22 15:08:02 CDT 2016


Corey Farrell has uploaded a new change for review.

  https://gerrit.asterisk.org/3083

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

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/83/3083/1

diff --git a/res/res_fax.c b/res/res_fax.c
index 6282b13..ad6e238 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -2846,11 +2846,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/3083
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list