[Asterisk-code-review] res pjsip outbound registration: Fix leak on vector add fail... (asterisk[15])

Joshua Colp asteriskteam at digium.com
Wed Nov 8 04:56:50 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7079 )

Change subject: res_pjsip_outbound_registration: Fix leak on vector add failure.
......................................................................

res_pjsip_outbound_registration: Fix leak on vector add failure.

Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
---
M res/res_pjsip_outbound_registration.c
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved



diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 7fa6e2c..d9afcd2 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -1385,10 +1385,10 @@
 
 	AST_VECTOR_INIT(&state->client_state->outbound_auths, AST_VECTOR_SIZE(&registration->outbound_auths));
 	for (i = 0; i < AST_VECTOR_SIZE(&registration->outbound_auths); ++i) {
-		const char *name = ast_strdup(AST_VECTOR_GET(&registration->outbound_auths, i));
+		char *name = ast_strdup(AST_VECTOR_GET(&registration->outbound_auths, i));
 
-		if (name) {
-			AST_VECTOR_APPEND(&state->client_state->outbound_auths, name);
+		if (name && AST_VECTOR_APPEND(&state->client_state->outbound_auths, name)) {
+			ast_free(name);
 		}
 	}
 	state->client_state->retry_interval = registration->retry_interval;

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
Gerrit-Change-Number: 7079
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171108/ee8481aa/attachment.html>


More information about the asterisk-code-review mailing list