Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
1401:cc62d7862203 | 1402:aadfb395e933 |
---|---|
40 reader->getFrameCount() * reader->getChannelCount(); | 40 reader->getFrameCount() * reader->getChannelCount(); |
41 sv_samplerate_t rate = reader->getSampleRate(); | 41 sv_samplerate_t rate = reader->getSampleRate(); |
42 if (targetRate != 0.0 && targetRate != rate) { | 42 if (targetRate != 0.0 && targetRate != rate) { |
43 samples = sv_frame_t(double(samples) * targetRate / rate); | 43 samples = sv_frame_t(double(samples) * targetRate / rate); |
44 } | 44 } |
45 delete reader; | |
46 SVDEBUG << "AudioFileSizeEstimator: WAV file reader accepts this file, reports " | 45 SVDEBUG << "AudioFileSizeEstimator: WAV file reader accepts this file, reports " |
47 << samples << " samples" << endl; | 46 << samples << " samples" << endl; |
48 estimate = samples; | 47 estimate = samples; |
49 } else { | 48 } else { |
50 SVDEBUG << "AudioFileSizeEstimator: WAV file reader doesn't like this file, " | 49 SVDEBUG << "AudioFileSizeEstimator: WAV file reader doesn't like this file, " |
51 << "estimating from file size and extension instead" << endl; | 50 << "estimating from file size and extension instead" << endl; |
52 } | 51 } |
52 | |
53 delete reader; | |
54 reader = 0; | |
53 | 55 |
54 if (estimate == 0) { | 56 if (estimate == 0) { |
55 | 57 |
56 // The remainder just makes an estimate based on the file size | 58 // The remainder just makes an estimate based on the file size |
57 // and extension. We don't even know its sample rate at this | 59 // and extension. We don't even know its sample rate at this |