[Asterisk-code-review] res/res pjsip: Resources (udptl fd) are leaking for T.38 calls (asterisk[13.25])

Friendly Automation asteriskteam at digium.com
Wed Feb 13 11:38:26 CST 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/10995 )

Change subject: res/res_pjsip: Resources (udptl fd) are leaking for T.38 calls
......................................................................

res/res_pjsip: Resources (udptl fd) are leaking for T.38 calls

Fix unbalanced references for datastore t38_session_media

ASTERISK-28288

Change-Id: Id6dceceb06651b03f611bf33deb3061022fe5d0c
---
M res/res_pjsip_t38.c
1 file changed, 11 insertions(+), 6 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index cd225d4..62bbb48 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -147,18 +147,23 @@
 }
 
 /*! \brief Helper function which allocates datastore with a session media */
-static struct ast_datastore *create_datastore_session_media(struct ast_sip_session *session, struct ast_sip_session_media *session_media)
+static int create_datastore_session_media(struct ast_sip_session *session, struct ast_sip_session_media *session_media)
 {
 	struct ast_datastore *datastore = NULL;
 
-	if (!(datastore = ast_sip_session_alloc_datastore(&session_media_datastore, "t38_session_media"))
-		|| ast_sip_session_add_datastore(session, datastore)) {
-		return NULL;
+	if (!(datastore = ast_sip_session_alloc_datastore(&session_media_datastore, "t38_session_media"))) {
+		return -1;
+	}
+
+	if (ast_sip_session_add_datastore(session, datastore)) {
+		ao2_ref(datastore, -1);
+		return -1;
 	}
 
 	datastore->data = session_media;
 	ao2_bump(session_media);
-	return datastore;
+	ao2_ref(datastore, -1);
+	return 0;
 }
 
 /*! \brief Helper function for changing the T.38 state */
@@ -296,7 +301,7 @@
 		return 0;
 	}
 
-	if (!create_datastore_session_media(session, session_media)) {
+	if (create_datastore_session_media(session, session_media)) {
 		return -1;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/10995
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13.25
Gerrit-MessageType: merged
Gerrit-Change-Id: Id6dceceb06651b03f611bf33deb3061022fe5d0c
Gerrit-Change-Number: 10995
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Paulo Vicentini <paulo.vicentini at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190213/22ca1ac1/attachment.html>


More information about the asterisk-code-review mailing list