[asterisk-commits] russell: trunk r123272 - in /trunk: ./ main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 17 10:52:13 CDT 2008


Author: russell
Date: Tue Jun 17 10:52:13 2008
New Revision: 123272

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123272
Log:
Merged revisions 123271 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r123271 | russell | 2008-06-17 10:48:31 -0500 (Tue, 17 Jun 2008) | 4 lines

Fix a memory leak in astobj2 that was pointed out by seanbright.  When a container
got destroyed, the underlying bucket list entry for each object that was in the
container at that time did not get free'd.

........

Modified:
    trunk/   (props changed)
    trunk/main/astobj2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astobj2.c?view=diff&rev=123272&r1=123271&r2=123272
==============================================================================
--- trunk/main/astobj2.c (original)
+++ trunk/main/astobj2.c Tue Jun 17 10:52:13 2008
@@ -808,8 +808,17 @@
 static void container_destruct(void *_c)
 {
 	struct ao2_container *c = _c;
+	int i;
 
 	_ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
+
+	for (i = 0; i < c->n_buckets; i++) {
+		struct bucket_list *cur;
+
+		while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+			ast_free(cur);
+		}
+	}
 
 #ifdef AO2_DEBUG
 	ast_atomic_fetchadd_int(&ao2.total_containers, -1);




More information about the asterisk-commits mailing list