From: Kevin P. Fleming Date: Mon, 23 Jul 2012 14:51:21 +0000 (+0000) Subject: Free any datastores attached to dummy channels. X-Git-Tag: 10.8.0-rc1~3^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ce5e6ada2e8a616f3a7ae92e4007675249704e3;p=thirdparty%2Fasterisk.git Free any datastores attached to dummy channels. 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) ........ Merged revisions 370360 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@370361 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/channel.c b/main/channel.c index e703b6dabd..4c317b530e 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2527,6 +2527,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;