raop: Fix a memory leak
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Wed, 19 Nov 2014 16:43:07 +0000 (18:43 +0200)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 20 Nov 2014 19:38:40 +0000 (21:38 +0200)
a.path_or_host wasn't freed after calling pa_parse_address().

src/modules/raop/raop_client.c

index 5bb0bb4..7a6d009 100644 (file)
@@ -372,14 +372,19 @@ pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) {
     pa_assert(core);
     pa_assert(host);
 
-    if (pa_parse_address(host, &a) < 0 || a.type == PA_PARSED_ADDRESS_UNIX)
+    if (pa_parse_address(host, &a) < 0)
         return NULL;
 
+    if (a.type == PA_PARSED_ADDRESS_UNIX) {
+        pa_xfree(a.path_or_host);
+        return NULL;
+    }
+
     c = pa_xnew0(pa_raop_client, 1);
     c->core = core;
     c->fd = -1;
 
-    c->host = pa_xstrdup(a.path_or_host);
+    c->host = a.path_or_host;
     if (a.port)
         c->port = a.port;
     else