[svn-commits] simon.perreault: branch group/v6-new r273182 - /team/group/v6-new/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 30 08:10:01 CDT 2010


Author: simon.perreault
Date: Wed Jun 30 08:09:57 2010
New Revision: 273182

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273182
Log:
Fixed use of uninitialized variable and memory leak.

Modified:
    team/group/v6-new/channels/chan_sip.c

Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=273182&r1=273181&r2=273182
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Wed Jun 30 08:09:57 2010
@@ -4215,7 +4215,6 @@
 	struct ast_variable *var = NULL;
 	struct ast_variable *varregs = NULL;
 	struct ast_variable *tmp;
-	struct ast_sockaddr *addrs;
 	struct ast_config *peerlist = NULL;
 	char ipaddr[INET_ADDRSTRLEN];
 	char portstring[6]; /*up to 5 digits plus null terminator*/
@@ -4242,14 +4241,18 @@
 			if (var && addr) {
 				for (tmp = var; tmp; tmp = tmp->next) {
 					if (!strcasecmp(tmp->name, "host")) {
-						if ( ast_sockaddr_resolve(&addrs, tmp->value, PARSE_PORT_FORBID, 0) <= 0
-										|| ast_sockaddr_cmp(&addrs[0], addr)) {
+						struct ast_sockaddr *addrs = NULL;
+
+						if (ast_sockaddr_resolve(&addrs,
+									 tmp->value,
+									 PARSE_PORT_FORBID,
+									 0) <= 0 ||
+						    ast_sockaddr_cmp(&addrs[0], addr)) {
 							/* No match */
 							ast_variables_destroy(var);
 							var = NULL;
-						} else {
-							ast_free(addrs);
 						}
+						ast_free(addrs);
 						break;
 					}
 				}




More information about the svn-commits mailing list