diff options
author | Jesper Tragardh <jesper.tragardh@sonymobile.com> | 2014-03-24 14:12:43 +0100 |
---|---|---|
committer | Henrik Baard <henrik.baard@sonymobile.com> | 2014-04-11 11:02:36 +0200 |
commit | 48412dc92c4cc92a3f4821616e12290f5eeabd07 (patch) | |
tree | 8768bcbd664073a00f379bdc4b65b9df260943fa /libvideoeditor | |
parent | 51b3ea2b8f7298bffbd246c65a606cd053357b66 (diff) | |
download | frameworks_av-48412dc92c4cc92a3f4821616e12290f5eeabd07.zip frameworks_av-48412dc92c4cc92a3f4821616e12290f5eeabd07.tar.gz frameworks_av-48412dc92c4cc92a3f4821616e12290f5eeabd07.tar.bz2 |
Fix memory leak when filtering commands in insertCommand_l()
When AudioPolicyService::AudioCommandThread::insertCommand_l filters
a command from the queue, the AudioCommand* is removed from the
vector mAudioCommands by calling mAudioCommands.removeAt(). This will
destroy the pointer and compact the vector, but not delete the
AudioCommand object.
This patch adds code to delete a filtered out AudioCommand and its
data object mParam. However, mParam was void* and deleting a void
pointer is undefined behavior according to the C++
standard. Therefore, the data classes are modified to inherit
from an abstract base class with a virtual destructor.
The deletion of non-filtered commands in
AudioPolicyService::AudioCommandThread::threadLoop() was already
correct, as each case casts mParam to the proper type before
deleting.
This also fixes AOSP issue 36370.
Change-Id: I2b63838aff3608132aa496f964a929f78c4b6267
Diffstat (limited to 'libvideoeditor')
0 files changed, 0 insertions, 0 deletions