From faf41f7d9689ea2a99fdb3ae40ac3010a5528187 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 12 Nov 2005 12:17:04 +0000 Subject: [PATCH] Prevent a possible memory leak. --- simgear/sound/sample_openal.cxx | 7 ++----- simgear/sound/sample_openal.hxx | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/simgear/sound/sample_openal.cxx b/simgear/sound/sample_openal.cxx index 366b6105..705b4d54 100644 --- a/simgear/sound/sample_openal.cxx +++ b/simgear/sound/sample_openal.cxx @@ -141,8 +141,7 @@ SGSoundSample::SGSoundSample( const char *path, const char *file) : } // constructor -SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq, - bool cleanup) : +SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq ) : buffer(0), source(0), pitch(1.0), @@ -180,9 +179,7 @@ SGSoundSample::SGSoundSample( unsigned char *_data, int len, int _freq, throw sg_exception("Failed to buffer data."); } - if ( cleanup ) { - free(_data); - } + free(_data); print_openal_error("constructor return"); } diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index 0f6d2a62..905ce8a1 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -117,11 +117,10 @@ public: * @param _data Pointer to a memory buffer containing the sample data * @param len Byte length of array * @param _freq Frequency of the provided data (bytes per second) - * @param cleanup Request clean up the intermediate data (this should usually be true unless you want to manipulate the data later.) */ - SGSoundSample( unsigned char *_data, int len, int _freq, bool cleanup ); + SGSoundSample( unsigned char *_data, int len, int _freq ); ~SGSoundSample(); -- 2.39.5