Mercurial > hg > svcore
comparison data/fileio/test/EncodingTest.h @ 1402:aadfb395e933
Fix some one-off memory leaks (including distracting ones in tests)
author | Chris Cannam |
---|---|
date | Mon, 06 Mar 2017 17:37:23 +0000 |
parents | 8eddb528ef0c |
children | 87ae75da6527 |
comparison
equal
deleted
inserted
replaced
1401:cc62d7862203 | 1402:aadfb395e933 |
---|---|
105 AudioFileReader *reader = | 105 AudioFileReader *reader = |
106 AudioFileReaderFactory::createReader | 106 AudioFileReaderFactory::createReader |
107 (encodingDir + "/" + audiofile, params); | 107 (encodingDir + "/" + audiofile, params); |
108 | 108 |
109 QVERIFY(reader != nullptr); | 109 QVERIFY(reader != nullptr); |
110 | |
111 delete reader; | |
110 } | 112 } |
111 | 113 |
112 void readMetadata_data() { | 114 void readMetadata_data() { |
113 addAudioFiles(); | 115 addAudioFiles(); |
114 } | 116 } |
130 | 132 |
131 QStringList fileAndExt = audiofile.split("."); | 133 QStringList fileAndExt = audiofile.split("."); |
132 QString file = fileAndExt[0]; | 134 QString file = fileAndExt[0]; |
133 QString extension = fileAndExt[1]; | 135 QString extension = fileAndExt[1]; |
134 | 136 |
135 if (extension != "wav") { | 137 if (extension == "wav") { |
138 | |
139 // Nothing | |
140 | |
141 delete reader; | |
142 | |
143 } else { | |
136 | 144 |
137 #if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND)) | 145 #if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND)) |
138 if (extension == "ogg") { | 146 if (extension == "ogg") { |
139 QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata"); | 147 QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata"); |
140 } | 148 } |
142 | 150 |
143 auto blah = reader->getInterleavedFrames(0, 10); | 151 auto blah = reader->getInterleavedFrames(0, 10); |
144 | 152 |
145 QString title = reader->getTitle(); | 153 QString title = reader->getTitle(); |
146 QVERIFY(title != QString()); | 154 QVERIFY(title != QString()); |
155 | |
156 delete reader; | |
147 | 157 |
148 bool found = false; | 158 bool found = false; |
149 for (int m = 0; m < mappingCount; ++m) { | 159 for (int m = 0; m < mappingCount; ++m) { |
150 if (file == QString::fromUtf8(mapping[m][0])) { | 160 if (file == QString::fromUtf8(mapping[m][0])) { |
151 found = true; | 161 found = true; |