diff data/fileio/AudioFileSizeEstimator.cpp @ 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 c0fece5e7755
children 70e172e6cc59 f8e3dcbafb4d
line wrap: on
line diff
--- a/data/fileio/AudioFileSizeEstimator.cpp	Mon Mar 06 17:23:46 2017 +0000
+++ b/data/fileio/AudioFileSizeEstimator.cpp	Mon Mar 06 17:37:23 2017 +0000
@@ -42,7 +42,6 @@
         if (targetRate != 0.0 && targetRate != rate) {
             samples = sv_frame_t(double(samples) * targetRate / rate);
         }
-        delete reader;
         SVDEBUG << "AudioFileSizeEstimator: WAV file reader accepts this file, reports "
                 << samples << " samples" << endl;
         estimate = samples;
@@ -51,6 +50,9 @@
                 << "estimating from file size and extension instead" << endl;
     }
 
+    delete reader;
+    reader = 0;
+
     if (estimate == 0) {
 
         // The remainder just makes an estimate based on the file size