[asterisk-commits] eliel: branch eliel/data_api_providers_gsoc2010 r260742 - /team/eliel/data_ap...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 3 12:38:54 CDT 2010


Author: eliel
Date: Mon May  3 12:38:50 2010
New Revision: 260742

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=260742
Log:
- Fix a leak in the SIP data provider.
- Fix a double unref in the unit test.


Modified:
    team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c

Modified: team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c?view=diff&rev=260742&r1=260741&r2=260742
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c (original)
+++ team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c Mon May  3 12:38:50 2010
@@ -27084,7 +27084,6 @@
 	peer->type = SIP_TYPE_USER;
 	peer->call_limit = 10;
 	ao2_link(peers, peer);
-	ao2_ref(peer, -1);
 
 	/* retrieve the chan_sip/peers tree and check the created peer. */
 	node = ast_data_get(&query);
@@ -27098,18 +27097,21 @@
 	if (strcmp(ast_data_retrieve_string(node, "peer/name"), "test_peer_data_provider")) {
 		ao2_unlink(peers, peer);
 		ao2_ref(peer, -1);
+		ast_data_free(node);
 		return AST_TEST_FAIL;
 	}
 
 	if (strcmp(ast_data_retrieve_string(node, "peer/type"), "user")) {
 		ao2_unlink(peers, peer);
 		ao2_ref(peer, -1);
+		ast_data_free(node);
 		return AST_TEST_FAIL;
 	}
 
 	if (ast_data_retrieve_int(node, "peer/call_limit") != 10) {
 		ao2_unlink(peers, peer);
 		ao2_ref(peer, -1);
+		ast_data_free(node);
 		return AST_TEST_FAIL;
 	}
 
@@ -27193,6 +27195,7 @@
 		data_peer = ast_data_add_node(data_root, "peer");
 		if (!data_peer) {
 			ao2_unlock(peer);
+			ao2_ref(peer, -1);
 			continue;
 		}
 
@@ -27237,6 +27240,7 @@
 		}
 
 		ao2_unlock(peer);
+		ao2_ref(peer, -1);
 	}
 	ao2_iterator_destroy(&i);
 




More information about the asterisk-commits mailing list