Prevent a possible memory leak.
This commit is contained in:
parent
7629e29397
commit
faf41f7d96
@ -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");
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user