datastores: Audit ast_channel_datastore_remove usage.

Audit of v1.8 usage of ast_channel_datastore_remove() for datastore memory
leaks.

* Fixed leaks in app_speech_utils and func_frame_trace.

* Fixed app_speech_utils not locking the channel when accessing the
channel datastore list.

Review: https://reviewboard.asterisk.org/r/3859/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@419684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2014-07-28 18:27:56 +00:00
parent 9e3411a762
commit dae78b0892
3 changed files with 39 additions and 20 deletions

View File

@@ -4573,6 +4573,7 @@ static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struc
/* No need to lock the channels because they are already locked in ast_do_masquerade */
if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(old_chan, datastore);
/* Datastore is freed in try_calling() */
} else {
ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
}
@@ -5445,6 +5446,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
}
if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(qe->chan, tds);
/* tds was added by setup_transfer_datastore() and is freed below. */
}
ast_channel_unlock(qe->chan);
update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));