From: Jens Axboe Date: Fri, 14 Nov 2008 12:06:06 +0000 (+0100) Subject: Fix leaks with using get_opt_postfix() X-Git-Tag: fio-1.23~2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=182ec6ee4e4d79fc5a705cd2e2811fa003add040;p=fio.git Fix leaks with using get_opt_postfix() It returns a strdup(), so remember to free() the result when done. Signed-off-by: Jens Axboe --- diff --git a/options.c b/options.c index f068ebd4..3d27f255 100644 --- 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; }