Skip to content

Commit ec406fa

Browse files
authored
Merge pull request #3484 from Konano:patch-2
fix(wechat_qrcode): fixed memory leaks
2 parents ccc2772 + 2b62ff6 commit ec406fa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ void DecodedBitStreamParser::decodeHanziSegment(Ref<BitSource> bits_, string& re
127127
while (count > 0) {
128128
// Each 13 bits encodes a 2-byte character
129129
int twoBytes = bits.readBits(13, err_handler);
130-
if (err_handler.ErrCode()) return;
130+
if (err_handler.ErrCode()) {
131+
delete[] buffer;
132+
return;
133+
}
131134
int assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060);
132135
if (assembledTwoBytes < 0x003BF) {
133136
// In the 0xA1A1 to 0xAAFE range

0 commit comments

Comments
 (0)