From: Joshua Colp Date: Tue, 18 Mar 2014 12:45:01 +0000 (+0000) Subject: res_pjsip: Fix memory leak of nameservers in off-nominal resolver creation failure. X-Git-Tag: 12.2.0-rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e3694609fd8538907167dbfa448864f07a3cfa2;p=thirdparty%2Fasterisk.git res_pjsip: Fix memory leak of nameservers in off-nominal resolver creation failure. Thanks Walter Doekes! git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@410844 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip/config_system.c b/res/res_pjsip/config_system.c index 8c4c548fa5..f88b96b895 100644 --- a/res/res_pjsip/config_system.c +++ b/res/res_pjsip/config_system.c @@ -201,6 +201,7 @@ static int system_create_resolver_and_set_nameservers(void *data) status = pjsip_endpt_create_resolver(ast_sip_get_pjsip_endpoint(), &resolver); if (status != PJ_SUCCESS) { ast_log(LOG_ERROR, "Could not create DNS resolver(%d), resorting to system resolution\n", status); + ao2_ref(discovered_nameservers, -1); return 0; } } @@ -241,4 +242,4 @@ static int system_create_resolver_and_set_nameservers(void *data) void ast_sip_initialize_dns(void) { ast_sip_push_task_synchronous(NULL, system_create_resolver_and_set_nameservers, NULL); -} \ No newline at end of file +}