summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-05-17 11:04:45 +0530
committerAmar Tumballi <amarts@redhat.com>2019-06-03 04:00:39 +0000
commit899b2170945c6023b0037fed70b19aa3cc680a22 (patch)
treea276a2c5668c6301f6c8f9f279da281ddc38b347 /xlators
parent950726dfc8e3171bef625b563c0c6dbba1ec2928 (diff)
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 <amarts@redhat.com> Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/locks/src/common.c1
-rw-r--r--xlators/features/locks/src/posix.c2
-rw-r--r--xlators/nfs/server/src/exports.c9
-rw-r--r--xlators/protocol/client/src/client-helpers.c3
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c1
5 files changed, 11 insertions, 5 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 0a9c9293f01..24422b494b9 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -1215,7 +1215,6 @@ pl_lock_preempt(pl_inode_t *pl_inode, posix_lock_t *reqlock)
{
pl_clean_local(rw->stub->frame->local);
call_unwind_error(rw->stub, -1, EBUSY);
- GF_FREE(lock);
}
return ret;
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 684a20824b0..d723d798804 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1226,9 +1226,9 @@ pl_getxattr_clrlk(xlator_t *this, const char *name, inode_t *inode,
out:
GF_FREE(brickname);
GF_FREE(args.opts);
+ GF_FREE(key);
if (op_ret) {
GF_FREE(lk_summary);
- GF_FREE(key);
}
return op_ret;
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:
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index 5873d67b486..52e1089900b 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -232,12 +232,15 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
list_add_tail(&entry->list, &entries->list);
trav = trav->nextentry;
+ entry = NULL;
}
ret = 0;
out:
if (buf)
GF_FREE(buf);
+ if (entry)
+ gf_dirent_entry_free(entry);
return ret;
}
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 16f175c21b8..8beb80d7696 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -4824,6 +4824,7 @@ unlock:
op_ret = -1;
op_errno = EINVAL;
GF_FREE(array);
+ array = NULL;
goto out;
}
array = NULL;