summaryrefslogtreecommitdiffstats
path: root/media/audio/linux
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 19:16:57 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 19:16:57 +0000
commita3ff4155c65daf09ef583483cbf287378d1766e4 (patch)
tree0dd3831c09004a62f7f1cf982738bf65879675a4 /media/audio/linux
parent32ca1468aaa9c68b4ddf3bd770e3fe6d693d5cdc (diff)
downloadchromium_src-a3ff4155c65daf09ef583483cbf287378d1766e4.zip
chromium_src-a3ff4155c65daf09ef583483cbf287378d1766e4.tar.gz
chromium_src-a3ff4155c65daf09ef583483cbf287378d1766e4.tar.bz2
Bug-fixes for AudioInputStream:
- s/scoped_ptr/scoped_array/ for new[]'d memory; this fixes a bug valgrind found and which can cause memory corruption (as delete was being called instead of delete[] before, which can confuse the allocator). - Fix memory leak where AlsaPcmInputStreams would fail to be deleted. Patch by fischman@chromium.org: http://codereview.chromium.org/6523027/ BUG=none TEST=valgrind media_unittests stops complaining about leaking the AIS and using delete instead of delete[]. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/linux')
-rw-r--r--media/audio/linux/alsa_input.cc3
-rw-r--r--media/audio/linux/alsa_input.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/media/audio/linux/alsa_input.cc b/media/audio/linux/alsa_input.cc
index 13aea5b4..afc37d6 100644
--- a/media/audio/linux/alsa_input.cc
+++ b/media/audio/linux/alsa_input.cc
@@ -7,7 +7,6 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/scoped_ptr.h"
#include "base/time.h"
#include "media/audio/linux/alsa_util.h"
#include "media/audio/linux/alsa_wrapper.h"
@@ -193,6 +192,8 @@ void AlsaPcmInputStream::Stop() {
}
void AlsaPcmInputStream::Close() {
+ scoped_ptr<AlsaPcmInputStream> self_deleter(this);
+
// Check in case we were already closed or not initialized yet.
if (!device_handle_ || !callback_)
return;
diff --git a/media/audio/linux/alsa_input.h b/media/audio/linux/alsa_input.h
index 94af7df..4e99ba3 100644
--- a/media/audio/linux/alsa_input.h
+++ b/media/audio/linux/alsa_input.h
@@ -59,7 +59,7 @@ class AlsaPcmInputStream : public AudioInputStream {
base::Time next_read_time_; // Scheduled time for the next read callback.
snd_pcm_t* device_handle_; // Handle to the ALSA PCM recording device.
ScopedRunnableMethodFactory<AlsaPcmInputStream> task_factory_;
- scoped_ptr<uint8> audio_packet_; // Data buffer used for reading audio data.
+ scoped_array<uint8> audio_packet_; // Buffer used for reading audio data.
DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream);
};