compositor: Don't free an uninitialised pointer.
authorOndřej Majerech <majerech.o@gmail.com>
Thu, 11 Sep 2014 13:53:15 +0000 (15:53 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 12 Sep 2014 06:38:39 +0000 (09:38 +0300)
When backend_init returns NULL, we goto out_signals, which wants to
free(modules), but in this particular code path, modules hasn't been
initialised leading to a "Double-free or corruption" error message.
Initialising modules to NULL makes the free a no-op in this scenario.

Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
src/compositor.c

index b0bc86c..a219766 100644 (file)
@@ -4335,7 +4335,8 @@ int main(int argc, char *argv[])
        int i, fd;
        char *backend = NULL;
        char *shell = NULL;
-       char *modules, *option_modules = NULL;
+       char *modules = NULL;
+       char *option_modules = NULL;
        char *log = NULL;
        char *server_socket = NULL, *end;
        int32_t idle_time = 300;