From 7e92f2981c80e4e6235c80e159ed7fef50463775 Mon Sep 17 00:00:00 2001 From: Lauri Laanmets Date: Mon, 21 Mar 2016 16:11:51 +0200 Subject: [PATCH] Fix memory leaks. --- src/zxing/zxing/qrcode/encoder/Encoder.h | 2 +- src/zxing/zxing/qrcode/encoder/QREncoder.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zxing/zxing/qrcode/encoder/Encoder.h b/src/zxing/zxing/qrcode/encoder/Encoder.h index 8086aad..db4308e 100644 --- a/src/zxing/zxing/qrcode/encoder/Encoder.h +++ b/src/zxing/zxing/qrcode/encoder/Encoder.h @@ -60,7 +60,7 @@ private: //static bool isOnlyDoubleByteKanji(const QString& content); static int chooseMaskPattern(Ref bits, - ErrorCorrectionLevel ecLevel, + ErrorCorrectionLevel& ecLevel, Ref version, Ref matrix); diff --git a/src/zxing/zxing/qrcode/encoder/QREncoder.cpp b/src/zxing/zxing/qrcode/encoder/QREncoder.cpp index 21c1eee..0dff400 100644 --- a/src/zxing/zxing/qrcode/encoder/QREncoder.cpp +++ b/src/zxing/zxing/qrcode/encoder/QREncoder.cpp @@ -97,7 +97,7 @@ Ref Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve // Put data together into the overall payload headerAndDataBits.appendBitArray(dataBits); - zxing::qrcode::ECBlocks ecBlocks = version->getECBlocksForLevel(ecLevel); + zxing::qrcode::ECBlocks &ecBlocks = version->getECBlocksForLevel(ecLevel); int numDataBytes = version->getTotalCodewords() - ecBlocks.getTotalECCodewords(); // Terminate the bits properly. @@ -111,7 +111,7 @@ Ref Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve Ref qrCode(new QRCode); - qrCode->setECLevel(Ref(&ecLevel)); + qrCode->setECLevel(Ref(new ErrorCorrectionLevel(ecLevel))); qrCode->setMode(mode); qrCode->setVersion(version); @@ -202,7 +202,7 @@ Mode Encoder::chooseMode(const QString& content, const QString& encoding) //} int Encoder::chooseMaskPattern(Ref bits, - ErrorCorrectionLevel ecLevel, + ErrorCorrectionLevel& ecLevel, Ref version, Ref matrix) {