[asterisk-commits] russell: branch russell/ast_channel_ao2 r183814 - /team/russell/ast_channel_a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 23 15:45:37 CDT 2009


Author: russell
Date: Mon Mar 23 15:45:33 2009
New Revision: 183814

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183814
Log:
Fix a potential reference leak

Modified:
    team/russell/ast_channel_ao2/res/res_agi.c

Modified: team/russell/ast_channel_ao2/res/res_agi.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/res/res_agi.c?view=diff&rev=183814&r1=183813&r2=183814
==============================================================================
--- team/russell/ast_channel_ao2/res/res_agi.c (original)
+++ team/russell/ast_channel_ao2/res/res_agi.c Mon Mar 23 15:45:33 2009
@@ -1827,12 +1827,14 @@
 	char tmp[4096];
 	struct ast_channel *chan2=NULL;
 
-	if ((argc != 4) && (argc != 5))
-		return RESULT_SHOWUSAGE;
+	if (argc != 4 && argc != 5) {
+		return RESULT_SHOWUSAGE;
+	}
+
 	if (argc == 5) {
 		chan2 = ast_channel_get_by_name(argv[4]);
 	} else {
-		chan2 = chan;
+		chan2 = ast_channel_ref(chan);
 	}
 
 	if (chan2) {
@@ -1842,7 +1844,7 @@
 		ast_agi_send(agi->fd, chan, "200 result=0\n");
 	}
 
-	if (chan2 && (chan2 != chan)) {
+	if (chan2) {
 		chan2 = ast_channel_unref(chan2);
 	}
 




More information about the asterisk-commits mailing list