SID Input: Clean up memory leaks

Two were potential memory leaks on file errors, one was a guaranteed
leak when reading metadata.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-11 04:19:27 -08:00
parent b40b8521dd
commit 425306129f
2 changed files with 8 additions and 2 deletions

View File

@ -49,8 +49,10 @@
SidTune *tune = new SidTune((const uint_least8_t *)data, (uint_least32_t)size);
if(!tune->getStatus())
if(!tune->getStatus()) {
delete tune;
return 0;
}
const SidTuneInfo *info = tune->getInfo();

View File

@ -44,8 +44,10 @@
SidTune *tune = new SidTune((const uint_least8_t *)data, (uint_least32_t)size);
if(!tune->getStatus())
if(!tune->getStatus()) {
delete tune;
return 0;
}
const SidTuneInfo *info = tune->getInfo();
@ -54,6 +56,8 @@
NSString *titletag = info->songs() > 1 ? @"album" : @"title";
NSString *artist = count >= 2 ? [[NSString stringWithUTF8String:info->infoString(1)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] : @"";
delete tune;
return @{titletag: title, @"artist": artist};
}