server: ensure that server pid file mem is always freed
authorJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:37:34 +0000 (11:37 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:37:34 +0000 (11:37 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
init.c
server.c

diff --git a/init.c b/init.c
index e9e49ebb3e478f6db4733714a1663ca567969843..1c37ab92f5209af2830e3b9920f8ffa64b47fc80 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1985,6 +1985,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
 
        if (is_backend && backend)
                return fio_start_server(pid_file);
+       else if (pid_file)
+               free(pid_file);
 
        if (td) {
                if (!ret)
index beee2db19d2a346b9184b5a88393f5e520a80ec6..73866d770e3f3dc7722bec9434f70b054cd5e1cb 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1683,6 +1683,7 @@ int fio_start_server(char *pidfile)
        if (check_existing_pidfile(pidfile)) {
                log_err("fio: pidfile %s exists and server appears alive\n",
                                                                pidfile);
+               free(pidfile);
                return -1;
        }
 
@@ -1694,6 +1695,7 @@ int fio_start_server(char *pidfile)
        } else if (pid) {
                int ret = write_pid(pid, pidfile);
 
+               free(pidfile);
                exit(ret);
        }