]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Free any datastores attached to dummy channels.
authorKevin P. Fleming <kpfleming@digium.com>
Mon, 23 Jul 2012 14:41:03 +0000 (14:41 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Mon, 23 Jul 2012 14:41:03 +0000 (14:41 +0000)
Revision 370205 added the use of a datastore attached to a dummy channel to
resolve a memory leak, but ast_dummy_channel_destructor() in this branch did
not free datastores, resulting in a continued (but slightly smaller) memory
leak. This patch backports the change to free said datastores from the Asterisk
trunk.

(related to issue AST-916)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@370360 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 05186025cdc4e2f7982e2d7d886dc7f5b88bfb1f..2aca0c434faf43356aa9e6cc37f0aa2ddd6a994c 100644 (file)
@@ -2499,6 +2499,13 @@ static void ast_dummy_channel_destructor(void *obj)
        struct ast_channel *chan = obj;
        struct ast_var_t *vardata;
        struct varshead *headp;
+       struct ast_datastore *datastore;
+
+       /* Get rid of each of the data stores on the channel */
+       while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) {
+               /* Free the data store */
+               ast_datastore_free(datastore);
+       }
 
        headp = &chan->varshead;