Fix memory leaks.

This commit is contained in:
Lauri Laanmets 2016-03-21 16:11:51 +02:00
parent 00d0e8d8d0
commit 7e92f2981c
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ private:
//static bool isOnlyDoubleByteKanji(const QString& content); //static bool isOnlyDoubleByteKanji(const QString& content);
static int chooseMaskPattern(Ref<BitArray> bits, static int chooseMaskPattern(Ref<BitArray> bits,
ErrorCorrectionLevel ecLevel, ErrorCorrectionLevel& ecLevel,
Ref<Version> version, Ref<Version> version,
Ref<ByteMatrix> matrix); Ref<ByteMatrix> matrix);

View File

@ -97,7 +97,7 @@ Ref<QRCode> Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve
// Put data together into the overall payload // Put data together into the overall payload
headerAndDataBits.appendBitArray(dataBits); headerAndDataBits.appendBitArray(dataBits);
zxing::qrcode::ECBlocks ecBlocks = version->getECBlocksForLevel(ecLevel); zxing::qrcode::ECBlocks &ecBlocks = version->getECBlocksForLevel(ecLevel);
int numDataBytes = version->getTotalCodewords() - ecBlocks.getTotalECCodewords(); int numDataBytes = version->getTotalCodewords() - ecBlocks.getTotalECCodewords();
// Terminate the bits properly. // Terminate the bits properly.
@ -111,7 +111,7 @@ Ref<QRCode> Encoder::encode(const QString& content, ErrorCorrectionLevel &ecLeve
Ref<QRCode> qrCode(new QRCode); Ref<QRCode> qrCode(new QRCode);
qrCode->setECLevel(Ref<ErrorCorrectionLevel>(&ecLevel)); qrCode->setECLevel(Ref<ErrorCorrectionLevel>(new ErrorCorrectionLevel(ecLevel)));
qrCode->setMode(mode); qrCode->setMode(mode);
qrCode->setVersion(version); qrCode->setVersion(version);
@ -202,7 +202,7 @@ Mode Encoder::chooseMode(const QString& content, const QString& encoding)
//} //}
int Encoder::chooseMaskPattern(Ref<BitArray> bits, int Encoder::chooseMaskPattern(Ref<BitArray> bits,
ErrorCorrectionLevel ecLevel, ErrorCorrectionLevel& ecLevel,
Ref<Version> version, Ref<Version> version,
Ref<ByteMatrix> matrix) Ref<ByteMatrix> matrix)
{ {