[asterisk-commits] rizzo: branch 1.4 r88471 - in /branches/1.4: apps/ channels/ include/asterisk...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Nov 4 16:38:14 CST 2007


Author: rizzo
Date: Sun Nov  4 16:38:13 2007
New Revision: 88471

URL: http://svn.digium.com/view/asterisk?view=rev&rev=88471
Log:
Rename ast_string_field_free_pool to ast_string_field_free_memory,
and ast_string_field_free_all to ast_string_field_reset_all
to avoid misuse (due to too similar names and an error in
documentation). Fix two related memory leaks in app_meetme.

No need to merge to trunk, different fix already applied there.
Not applicable to 1.2


Modified:
    branches/1.4/apps/app_meetme.c
    branches/1.4/channels/chan_iax2.c
    branches/1.4/channels/chan_sip.c
    branches/1.4/include/asterisk/stringfields.h
    branches/1.4/main/channel.c

Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=88471&r1=88470&r2=88471
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Sun Nov  4 16:38:13 2007
@@ -4406,7 +4406,7 @@
 	while ((station_ref = AST_LIST_REMOVE_HEAD(&trunk->stations, entry)))
 		free(station_ref);
 
-	ast_string_field_free_all(trunk);
+	ast_string_field_free_memory(trunk);
 	free(trunk);
 }
 
@@ -4432,7 +4432,7 @@
 	while ((trunk_ref = AST_LIST_REMOVE_HEAD(&station->trunks, entry)))
 		free(trunk_ref);
 
-	ast_string_field_free_all(station);
+	ast_string_field_free_memory(station);
 	free(station);
 }
 

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=88471&r1=88470&r2=88471
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Sun Nov  4 16:38:13 2007
@@ -2010,7 +2010,7 @@
 				iax2_frame_free(frame.data);
 			jb_destroy(pvt->jb);
 			/* gotta free up the stringfields */
-			ast_string_field_free_pools(pvt);
+			ast_string_field_free_memory(pvt);
 			free(pvt);
 		}
 	}
@@ -8955,7 +8955,7 @@
 	if (peer->dnsmgr)
 		ast_dnsmgr_release(peer->dnsmgr);
 
-	ast_string_field_free_pools(peer);
+	ast_string_field_free_memory(peer);
 }
 
 /*! \brief Create peer structure based on configuration */
@@ -9198,7 +9198,7 @@
 		ast_variables_destroy(user->vars);
 		user->vars = NULL;
 	}
-	ast_string_field_free_pools(user);
+	ast_string_field_free_memory(user);
 }
 
 /*! \brief Create in-memory user structure from configuration */
@@ -9239,7 +9239,7 @@
 	
 	if (user) {
 		if (firstpass) {
-			ast_string_field_free_pools(user);
+			ast_string_field_free_memory(user);
 			memset(user, 0, sizeof(struct iax2_user));
 			if (ast_string_field_init(user, 32)) {
 				user = user_unref(user);

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=88471&r1=88470&r2=88471
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sun Nov  4 16:38:13 2007
@@ -2999,7 +2999,7 @@
 		ast_sched_del(sched, reg->expire);
 	if (reg->timeout > -1)
 		ast_sched_del(sched, reg->timeout);
-	ast_string_field_free_pools(reg);
+	ast_string_field_free_memory(reg);
 	regobjs--;
 	free(reg);
 	
@@ -3100,7 +3100,7 @@
 	}
 	ast_mutex_destroy(&p->lock);
 
-	ast_string_field_free_pools(p);
+	ast_string_field_free_memory(p);
 
 	free(p);
 }
@@ -5892,7 +5892,7 @@
 {
 	struct sip_pvt *p = data;
 
-	ast_string_field_free_pools(p);
+	ast_string_field_free_memory(p);
 
 	free(data);
 }
@@ -5942,7 +5942,7 @@
 	__transmit_response(p, msg, req, XMIT_UNRELIABLE);
 
 	/* Free the string fields, but not the pool space */
-	ast_string_field_free_all(p);
+	ast_string_field_reset_all(p);
 
 	return 0;
 }

Modified: branches/1.4/include/asterisk/stringfields.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/stringfields.h?view=diff&rev=88471&r1=88470&r2=88471
==============================================================================
--- branches/1.4/include/asterisk/stringfields.h (original)
+++ branches/1.4/include/asterisk/stringfields.h Sun Nov  4 16:38:13 2007
@@ -74,7 +74,7 @@
   and their storage pool must be freed:
   
   \code
-  ast_string_field_free_all(sample);
+  ast_string_field_free_memory(sample);
   free(sample);
   \endcode
 */
@@ -361,7 +361,7 @@
   structure; it should only be called immediately before freeing
   the structure itself.
 */
-#define ast_string_field_free_pools(x) do { \
+#define ast_string_field_free_memory(x) do { \
 	struct ast_string_field_pool *this, *prev; \
 	for (this = (x)->__field_mgr.pool; this; this = prev) { \
 		prev = this->prev; \
@@ -378,7 +378,7 @@
   attached to the structure will be available for use by
   stringfields again.
 */
-#define ast_string_field_free_all(x) do { \
+#define ast_string_field_reset_all(x) do { \
 	int index; \
 	for (index = 0; index < ast_string_field_count(x); index++) \
 		ast_string_field_index_free(x, index); \

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?view=diff&rev=88471&r1=88470&r2=88471
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Sun Nov  4 16:38:13 2007
@@ -776,7 +776,7 @@
 	if (needqueue) {
 		if (pipe(tmp->alertpipe)) {
 			ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
-			ast_string_field_free_pools(tmp);
+			ast_string_field_free_memory(tmp);
 			free(tmp);
 			return NULL;
 		} else {
@@ -1265,7 +1265,7 @@
 	/* Destroy the jitterbuffer */
 	ast_jb_destroy(chan);
 
-	ast_string_field_free_pools(chan);
+	ast_string_field_free_memory(chan);
 	free(chan);
 	AST_LIST_UNLOCK(&channels);
 




More information about the asterisk-commits mailing list