set fPanRamp and fGainRamp to NULL after deleting them, otherwise they could be double-freed. Also dont' check for NULL before calling delete. CID 1230 and 1231

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27511 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2008-09-15 07:17:27 +00:00
parent dd52d6d1a0
commit b56c51bcba

View File

@ -147,8 +147,9 @@ GameSoundBuffer::SetGain(float gain, bigtime_t duration)
if (gain < 0.0 || gain > 1.0)
return B_BAD_VALUE;
if (fGainRamp) delete fGainRamp;
delete fGainRamp;
fGainRamp = NULL;
if (duration > 100000)
fGainRamp = InitRamp(&fGain, gain, fFormat.frame_rate, duration);
else
@ -171,9 +172,9 @@ GameSoundBuffer::SetPan(float pan, bigtime_t duration)
if (pan < -1.0 || pan > 1.0)
return B_BAD_VALUE;
if (fPanRamp)
delete fPanRamp;
delete fPanRamp;
fPanRamp = NULL;
if (duration < 100000) {
fPan = pan;