From: Corey Farrell Date: Mon, 6 Nov 2017 23:55:00 +0000 (-0500) Subject: res_pjsip_outbound_registration: Fix leak on vector add failure. X-Git-Tag: 15.2.0-rc1~159^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e147cbf9e6844ea5b0c596a67f1bb602eb38f60;p=thirdparty%2Fasterisk.git res_pjsip_outbound_registration: Fix leak on vector add failure. Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46 --- diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 7fa6e2c10b..d9afcd284b 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -1385,10 +1385,10 @@ static int sip_outbound_registration_perform(void *data) AST_VECTOR_INIT(&state->client_state->outbound_auths, AST_VECTOR_SIZE(®istration->outbound_auths)); for (i = 0; i < AST_VECTOR_SIZE(®istration->outbound_auths); ++i) { - const char *name = ast_strdup(AST_VECTOR_GET(®istration->outbound_auths, i)); + char *name = ast_strdup(AST_VECTOR_GET(®istration->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;