From: Andre Noll Date: Mon, 12 Jun 2023 23:42:39 +0000 (+0200) Subject: afs: Fix memory leak in mood_load(). X-Git-Tag: v0.7.3~12^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=bb0aec0963b1b2da617aebda26deca576684436c;p=paraslash.git afs: Fix memory leak in mood_load(). In the result != NULL case we open a fresh score table but miss to close it if add_to_score_table() fails. This should never happen, but still.. Fixes: 2d2637cb4c9ab76fea6bc336b9af88fd00bf5e08 --- diff --git a/mood.c b/mood.c index ddd2f1cc..94ec3cd4 100644 --- a/mood.c +++ b/mood.c @@ -663,8 +663,11 @@ int mood_load(const char *mood_name, struct mood_instance **result, char **msg) } out: free(aa.array); - if (ret < 0) + if (ret < 0) { + if (aa.m->score_table) + score_close(aa.m->score_table); destroy_mood(aa.m); + } return ret; }