]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
afs: Fix memory leak in mood_load().
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index 000aaa54670714a195a6d8bce3e12f3f723017dc..9e679dcf14ebee2a36a83aa02882ba96950e7b21 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -437,14 +437,14 @@ static int activate_mood_or_playlist(const char *arg, struct para_buffer *pb)
        int ret;
        char *msg;
 
-       if (!arg) {
-               ret = mood_load(NULL, &msg);
+       if (!arg) { /* load dummy mood */
+               ret = mood_load(NULL, NULL, &msg);
                mode = PLAY_MODE_MOOD;
        } else if (!strncmp(arg, "p/", 2)) {
-               ret = playlist_load(arg + 2, &msg);
+               ret = playlist_load(arg + 2, NULL, &msg);
                mode = PLAY_MODE_PLAYLIST;
        } else if (!strncmp(arg, "m/", 2)) {
-               ret = mood_load(arg + 2, &msg);
+               ret = mood_load(arg + 2, NULL, &msg);
                mode = PLAY_MODE_MOOD;
        } else {
                ret = -ERRNO_TO_PARA_ERROR(EINVAL);
@@ -529,8 +529,8 @@ static void init_admissible_files(const char *arg)
 {
        int ret = activate_mood_or_playlist(arg, NULL);
        if (ret < 0) {
-               PARA_WARNING_LOG("could not activate %s: %s\n", arg,
-                       para_strerror(-ret));
+               PARA_WARNING_LOG("could not activate %s: %s\n", arg?
+                       arg : "dummy", para_strerror(-ret));
                if (arg)
                        activate_mood_or_playlist(NULL, NULL);
        }
@@ -962,7 +962,7 @@ __noreturn void afs_init(int socket_fd)
        }
        ret = schedule(&s);
        sched_shutdown(&s);
-       mood_unload();
+       mood_unload(NULL);
 out_close:
        close_afs_tables();
 out:
@@ -986,9 +986,9 @@ static int com_select_callback(struct afs_callback_arg *aca)
        arg = lls_input(0, aca->lpr);
        score_clear();
        if (current_play_mode == PLAY_MODE_MOOD)
-               mood_unload();
+               mood_unload(NULL);
        else
-               playlist_unload();
+               playlist_unload(NULL);
        ret = activate_mood_or_playlist(arg, &aca->pbout);
        if (ret >= 0)
                goto free_lpr;