Code

screen_lyrics: prevent a double free/use after free
[ncmpc.git] / src / plugin.c
index d7849009887ae92e9c1fba785376a2b465e6b098..f578575781fef6dde6b98999d24c5593ccaa50cc 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  
  * This program is free software; you can redistribute it and/or modify
@@ -168,7 +168,7 @@ plugin_eof(struct plugin_cycle *cycle, struct plugin_pipe *p)
        } else {
                /* success: invoke the callback */
                cycle->callback(cycle->pipe_stdout.data, true,
-                               cycle->callback_data);
+                               cycle->argv[0], cycle->callback_data);
        }
 }
 
@@ -217,7 +217,7 @@ plugin_delayed_fail(gpointer data)
        assert(cycle->pipe_stderr.fd < 0);
        assert(cycle->pid < 0);
 
-       cycle->callback(cycle->all_errors, false, cycle->callback_data);
+       cycle->callback(cycle->all_errors, false, NULL, cycle->callback_data);
 
        return FALSE;
 }
@@ -340,9 +340,8 @@ make_argv(const char*const* args)
        /* reserve space for the program name */
        *ret++ = NULL;
 
-       do {
+       while (*args != NULL)
                *ret++ = g_strdup(*args++);
-       } while (*args != NULL);
 
        /* end of argument vector */
        *ret++ = NULL;