[Scummvm-git-logs] scummvm master -> 952a2f527325a19e997b8ace3d17d72e871a17fc
whoozle
noreply at scummvm.org
Sat Nov 21 00:05:15 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
952a2f5273 AUDIO: WMA: Fix new[]/free mismatch
Commit: 952a2f527325a19e997b8ace3d17d72e871a17fc
https://github.com/scummvm/scummvm/commit/952a2f527325a19e997b8ace3d17d72e871a17fc
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-11-21T00:04:43Z
Commit Message:
AUDIO: WMA: Fix new[]/free mismatch
Passing `--enable-asan` to configure triggers an assertion about mismatched new[]/delete.
Buffers in wma decorer are allocated by new int16[...], but deallocated with free().
Replace array-new with calloc()
Changed paths:
audio/decoders/wma.cpp
diff --git a/audio/decoders/wma.cpp b/audio/decoders/wma.cpp
index 9288a0641b3..32ed2b5a3a8 100644
--- a/audio/decoders/wma.cpp
+++ b/audio/decoders/wma.cpp
@@ -590,7 +590,7 @@ Common::SeekableReadStream *WMACodec::decodeSuperFrame(Common::SeekableReadStrea
// PCM output data
outputDataSize = frameCount * _channels * _frameLen;
- outputData = new int16[outputDataSize]();
+ outputData = static_cast<int16*>(calloc(outputDataSize, sizeof(int16)));
// Number of bits data that completes the last superframe's overhang.
@@ -636,7 +636,7 @@ Common::SeekableReadStream *WMACodec::decodeSuperFrame(Common::SeekableReadStrea
// Decode the frames
for (int i = 0; i < newFrameCount; i++, _curFrame++)
if (!decodeFrame(bits, outputData)) {
- delete[] outputData;
+ free(outputData);
return nullptr;
}
@@ -665,12 +665,11 @@ Common::SeekableReadStream *WMACodec::decodeSuperFrame(Common::SeekableReadStrea
// PCM output data
outputDataSize = _channels * _frameLen;
- outputData = new int16[outputDataSize]();
-
+ outputData = static_cast<int16*>(calloc(outputDataSize, sizeof(int16)));
// Decode the frame
if (!decodeFrame(bits, outputData)) {
- delete[] outputData;
+ free(outputData);
return nullptr;
}
}
More information about the Scummvm-git-logs
mailing list