xl: free pid string in do_daemonize
authorWei Liu <wei.liu2@citrix.com>
Thu, 23 Jul 2015 07:59:05 +0000 (08:59 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 24 Jul 2015 10:27:52 +0000 (11:27 +0100)
Pid is a null terminated string allocated by asprintf. It should be
freed after use.

Also fixed a coding style problem while I was there.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/xl_cmdimpl.c

index a578e3b6e253bf1db54c6cef7b143cb8f548296e..9027acba81e198a272397b3e431b391d1cfa9522 100644 (file)
@@ -524,10 +524,12 @@ static int do_daemonize(char *name, const char *pidfile)
             exit(1);
         }
 
-        if ( close(fd) < 0 ) {
+        if (close(fd) < 0) {
             perror("Closing pidfile");
             exit(1);
         }
+
+        free(pid);
     }
 
 out: