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

Corey Farrell asteriskteam at digium.com
Mon Nov 6 17:56:12 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7078


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/78/7078/1

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/7078
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
Gerrit-Change-Number: 7078
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/0b5f54f8/attachment.html>


More information about the asterisk-code-review mailing list