From bb0aec0963b1b2da617aebda26deca576684436c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 13 Jun 2023 01:42:39 +0200 Subject: [PATCH] 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 --- mood.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.39.2