[svn-commits] mmichelson: trunk r199923 - /trunk/main/channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 10 13:58:15 CDT 2009


Author: mmichelson
Date: Wed Jun 10 13:58:12 2009
New Revision: 199923

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199923
Log:
Use ast_channel_unref to instead of ast_free on a newly created channel.

Also I removed an unnecessary free of a cid_name. This will be freed properly
in the channel destructor.

Reported by mnicholson in #asterisk-dev.


Modified:
    trunk/main/channel.c

Modified: trunk/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/channel.c?view=diff&rev=199923&r1=199922&r2=199923
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed Jun 10 13:58:12 2009
@@ -826,17 +826,14 @@
 		if (!(tmp->cid.cid_name = ast_strdup(cid_name))) {
 			ast_string_field_free_memory(tmp);
 			sched_context_destroy(tmp->sched);
-			ast_free(tmp);
-			return NULL;
+			return ast_channel_unref(tmp);
 		}
 	}
 	if (cid_num) {
 		if (!(tmp->cid.cid_num = ast_strdup(cid_num))) {
 			ast_string_field_free_memory(tmp);
 			sched_context_destroy(tmp->sched);
-			ast_free(tmp->cid.cid_name);
-			ast_free(tmp);
-			return NULL;
+			return ast_channel_unref(tmp);
 		}
 	}
 




More information about the svn-commits mailing list