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

Jenkins2 asteriskteam at digium.com
Wed Nov 8 07:03:38 CST 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7080 )

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
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 731a1a9..0b177ae 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -1386,10 +1386,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/7080
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
Gerrit-Change-Number: 7080
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/7a9545e2/attachment.html>


More information about the asterisk-code-review mailing list