]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - mood.c
afs: Really fix memory leak in mood_load().
[paraslash.git] / mood.c
diff --git a/mood.c b/mood.c
index 94ec3cd49ee3128348185d829acaa417fdbb5b5c..18c02f7fa2f0529175c4b84bfc73600354fa3211 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -134,6 +134,8 @@ static void destroy_mood(struct mood_instance *m)
        if (!m)
                return;
        mp_shutdown(m->parser_context);
+       if (m->score_table)
+               score_close(m->score_table);
        free(m->name);
        free(m);
 }
@@ -663,11 +665,8 @@ int mood_load(const char *mood_name, struct mood_instance **result, char **msg)
        }
 out:
        free(aa.array);
-       if (ret < 0) {
-               if (aa.m->score_table)
-                       score_close(aa.m->score_table);
+       if (ret < 0)
                destroy_mood(aa.m);
-       }
        return ret;
 }