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
parent
b40b8521dd
commit
425306129f
|
@ -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();
|
||||
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue