summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-08-02 10:51:40 +0200
committerAnand Avati <avati@redhat.com>2012-08-08 23:03:29 -0700
commite42faa7488b41513750ad37837ac52a68f639775 (patch)
tree53c4dab58cf3f7552299f5f42f4c3650b9dbee38
parent94271805633a1ee5487b036dfd81b63c0250df39 (diff)
fuse-bridge: fuse_thread_proc: avoid realloc-clobber induced leak upon OOM
Change-Id: I835d14b702b875bb07f41e157583592df9b72f36 BUG: 846755 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3792 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index fc294e7a8a5..e5fa3a6b61b 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -4163,11 +4163,12 @@ fuse_thread_proc (void *data)
msg = iov_in[1].iov_base;
else {
if (res > msg0_size) {
- iov_in[0].iov_base =
- GF_REALLOC (iov_in[0].iov_base, res);
- if (iov_in[0].iov_base)
+ void *b = GF_REALLOC (iov_in[0].iov_base, res);
+ if (b) {
+ iov_in[0].iov_base = b;
finh = (fuse_in_header_t *)
iov_in[0].iov_base;
+ }
else {
gf_log ("glusterfs-fuse", GF_LOG_ERROR,
"Out of memory");