From 899b2170945c6023b0037fed70b19aa3cc680a22 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 17 May 2019 11:04:45 +0530 Subject: across: coverity fixes * locks/posix.c: key was not freed in one of the cases. * locks/common.c: lock was being free'd out of context. * nfs/exports: handle case of missing free. * protocol/client: handle case of entry not freed. * storage/posix: handle possible case of double free CID: 1398628, 1400731, 1400732, 1400756, 1124796, 1325526 updates: bz#789278 Change-Id: Ieeaca890288bc4686355f6565f853dc8911344e8 Signed-off-by: Amar Tumballi Signed-off-by: Sheetal Pamecha --- xlators/nfs/server/src/exports.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/exports.c b/xlators/nfs/server/src/exports.c index c62e2d9a625..d7e39934851 100644 --- a/xlators/nfs/server/src/exports.c +++ b/xlators/nfs/server/src/exports.c @@ -647,6 +647,7 @@ __exp_line_opt_parse(const char *opt_str, struct export_options **exp_opts) if (!opts) { ret = -ENOMEM; parser_unset_string(options_parser); + GF_FREE(strmatch); goto out; } } @@ -677,7 +678,7 @@ __exp_line_opt_parse(const char *opt_str, struct export_options **exp_opts) _export_options_deinit(opts); goto out; } - } else + } else { /* Cannot change to gf_msg. * gf_msg not giving output to STDOUT * Bug id : BZ1215017 @@ -686,6 +687,7 @@ __exp_line_opt_parse(const char *opt_str, struct export_options **exp_opts) "Could not find any valid options for " "string: %s", strmatch); + } GF_FREE(strmatch); } @@ -1448,7 +1450,7 @@ exp_file_parse(const char *filepath, struct exports_file **expfile, GF_CHECK_ALLOC_AND_LOG(GF_EXP, file, ret, "Allocation error while " "allocating file struct", - parse_done); + free_and_done); file->filename = gf_strdup(filepath); GF_CHECK_ALLOC_AND_LOG(GF_EXP, file, ret, @@ -1470,7 +1472,8 @@ exp_file_parse(const char *filepath, struct exports_file **expfile, goto parse_done; free_and_done: - exp_file_deinit(file); + if (file) + exp_file_deinit(file); _export_dir_deinit(expdir); parse_done: -- cgit