]> git.mxchange.org Git - simgear.git/commitdiff
Prevent a possible memory leak.
authorehofman <ehofman>
Sat, 12 Nov 2005 12:17:04 +0000 (12:17 +0000)
committerehofman <ehofman>
Sat, 12 Nov 2005 12:17:04 +0000 (12:17 +0000)
simgear/sound/sample_openal.cxx
simgear/sound/sample_openal.hxx

index 366b6105a711a1a6a53fdd88ec8a6e752f49b387..705b4d545eceec5c833a2f217476101dda15c283 100644 (file)
@@ -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");
 }
index 0f6d2a62c6fb2d598cbe46b0d8b61bc82191641c..905ce8a106b49ba427dce11dc57b85be04b4b0cd 100644 (file)
@@ -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();