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

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


Corey Farrell has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/7079/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/7079
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46
Gerrit-Change-Number: 7079
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/a615e05f/attachment.html>


More information about the asterisk-code-review mailing list