Fix leaks with using get_opt_postfix()
authorJens Axboe <jens.axboe@oracle.com>
Fri, 14 Nov 2008 12:06:06 +0000 (13:06 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 14 Nov 2008 12:06:06 +0000 (13:06 +0100)
It returns a strdup(), so remember to free() the result when done.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
options.c

index f068ebd4fc8594ec4a1cbfbfa9c133d87dc2d62f..3d27f2551d6b55ab76fd3c93c71036c138e3bbe6 100644 (file)
--- a/options.c
+++ b/options.c
@@ -154,8 +154,10 @@ static int str_rw_cb(void *data, const char *str)
        char *nr = get_opt_postfix(str);
 
        td->o.ddir_nr = 1;
-       if (nr)
+       if (nr) {
                td->o.ddir_nr = atoi(nr);
+               free(nr);
+       }
 
        return 0;
 }
@@ -285,8 +287,10 @@ static int str_fst_cb(void *data, const char *str)
        char *nr = get_opt_postfix(str);
 
        td->file_service_nr = 1;
-       if (nr)
+       if (nr) {
                td->file_service_nr = atoi(nr);
+               free(nr);
+       }
 
        return 0;
 }
@@ -426,8 +430,10 @@ static int str_lockfile_cb(void *data, const char *str)
        char *nr = get_opt_postfix(str);
 
        td->o.lockfile_batch = 1;
-       if (nr)
+       if (nr) {
                td->o.lockfile_batch = atoi(nr);
+               free(nr);
+       }
 
        return 0;
 }