52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
From 015e6cac71b0a0c330f1e4792f9d60214b191f45 Mon Sep 17 00:00:00 2001
|
|
From: karthik-us <ksubrahm@redhat.com>
|
|
Date: Thu, 7 Oct 2021 21:07:46 +0530
|
|
Subject: [PATCH 603/610] Coverity: Resource leak fix (CID: 1356547)
|
|
|
|
Issue:
|
|
In function gf_svc_readdirp() there is a chance that 'local' will be allocated
|
|
memory but not released in the failure path.
|
|
|
|
Fix:
|
|
Assign 'local' to 'frame->local' immediately after the successful allocation, so
|
|
it will be released by the existing failure path code itself.
|
|
|
|
> Upstream patch: https://github.com/gluster/glusterfs/pull/2362/
|
|
> Change-Id: I4474dc4d4be5432d169cb7d434728f211054997e
|
|
> Signed-off-by: karthik-us <ksubrahm@redhat.com>
|
|
> Updates: gluster#1060
|
|
|
|
BUG: 1997447
|
|
Change-Id: I4474dc4d4be5432d169cb7d434728f211054997e
|
|
Signed-off-by: karthik-us <ksubrahm@redhat.com>
|
|
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/280100
|
|
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
---
|
|
xlators/features/snapview-client/src/snapview-client.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c
|
|
index 9c789ae..e97db89 100644
|
|
--- a/xlators/features/snapview-client/src/snapview-client.c
|
|
+++ b/xlators/features/snapview-client/src/snapview-client.c
|
|
@@ -2156,6 +2156,7 @@ gf_svc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
"failed to allocate local");
|
|
goto out;
|
|
}
|
|
+ frame->local = local;
|
|
|
|
/*
|
|
* This is mainly for samba shares (or windows clients). As part of
|
|
@@ -2184,7 +2185,6 @@ gf_svc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
|
local->subvolume = subvolume;
|
|
local->fd = fd_ref(fd);
|
|
- frame->local = local;
|
|
|
|
STACK_WIND(frame, gf_svc_readdirp_cbk, subvolume, subvolume->fops->readdirp,
|
|
fd, size, off, xdata);
|
|
--
|
|
1.8.3.1
|
|
|