From 62a15d55e20f01da68bf3fcc94a135ec3e9e7d1f Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Mon, 16 May 2011 06:57:01 +0300 Subject: [PATCH] ladishd: fix use of uninitialized memory For app-less clients, app_uuid is not initialized --- daemon/virtualizer.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/daemon/virtualizer.c b/daemon/virtualizer.c index 29b56ec9..d2c34e60 100644 --- a/daemon/virtualizer.c +++ b/daemon/virtualizer.c @@ -309,10 +309,18 @@ static void client_appeared(void * context, uint64_t id, const char * jack_name) } else { - client = ladish_graph_find_client_by_app(virtualizer_ptr->jack_graph, app_uuid); - if (client == NULL) + if (app != NULL) { - log_info("Lookup by app uuid failed, attempting lookup by name '%s'", name); + client = ladish_graph_find_client_by_app(virtualizer_ptr->jack_graph, app_uuid); + if (client == NULL) + { + log_info("Lookup by app uuid failed, attempting lookup by name '%s'", name); + goto find_by_name; + } + } + else + { + find_by_name: client = ladish_graph_find_client_by_name(virtualizer_ptr->jack_graph, name, true); } } @@ -322,7 +330,7 @@ static void client_appeared(void * context, uint64_t id, const char * jack_name) log_info("found existing client"); if (ladish_client_get_jack_id(client) != 0) { - log_error("Ignoring client with duplicate name '%s' ('%s')", name, jack_name); + ladish_graph_dump(virtualizer_ptr->jack_graph); goto exit; }