From 182ec6ee4e4d79fc5a705cd2e2811fa003add040 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 14 Nov 2008 13:06:06 +0100 Subject: [PATCH] Fix leaks with using get_opt_postfix() It returns a strdup(), so remember to free() the result when done. Signed-off-by: Jens Axboe --- options.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; } -- 2.25.1