summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
authorMohammed Azhar Padariyakam <mpadariy@redhat.com>2017-11-06 15:14:24 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-11-06 17:41:15 +0000
commit9a526c4faff0f96b2025dde252e3a622c1d6d188 (patch)
treee24f3d50bee63f8fd83ef1ef353493605348a37d /xlators/protocol/client
parent6707eddaa5d7fdce16d39c19963911868a2c7fee (diff)
xlators/client-rpc-fops: Fix Coverity Issues
Coverity Id: 803, 804 from [1] Problem: USE_AFTER_FREE code at client3_3_lookup: 3371 USE_AFTER_FREE at client3_3_readdir: 5562 Solution: Postponed iobuf_unref(rsp_iobuf) to a location after all dereferences of rsp_iobuf [1]:https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: I34f90d72b1248e5526ff1d2b3273cdab619cf4f8 BUG: 789278 Signed-off-by: Mohammed Azhar Padariyakam <mpadariy@redhat.com>
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index 0561def..2026a2b 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -3368,12 +3368,12 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this,
}
iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
rsphdr = &vector[0];
rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
count = 1;
local->iobref = rsp_iobref;
+ iobuf_unref (rsp_iobuf);
rsp_iobuf = NULL;
rsp_iobref = NULL;
}
@@ -5559,13 +5559,13 @@ client3_3_readdir (call_frame_t *frame, xlator_t *this,
}
iobref_add (rsp_iobref, rsp_iobuf);
- iobuf_unref (rsp_iobuf);
rsphdr = &vector[0];
rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
count = 1;
local->iobref = rsp_iobref;
+ iobuf_unref (rsp_iobuf);
rsp_iobuf = NULL;
rsp_iobref = NULL;
}