If the result pointer is NULL. we currently leak one playlist instance
structure (12 bytes on 32 bit, 20 bytes on 64 bit) each time a playlist
is loaded.
Found by valgrind.
Fixes: 2d2637cb4c9ab76fea6bc336b9af88fd00bf5e08
*msg = make_message("loaded playlist %s (%u files)\n", name,
pi->length);
pi->name = para_strdup(name);
- if (result)
+ if (result) {
*result = pi;
- else {
- playlist_unload(NULL);
- current_playlist = *pi;
+ return pi->length;
}
- return pi->length;
+ playlist_unload(NULL);
+ current_playlist = *pi;
+ free(pi);
+ return current_playlist.length;
close_score_table:
if (result)
score_close(pi->score_table);