From e42faa7488b41513750ad37837ac52a68f639775 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 2 Aug 2012 10:51:40 +0200 Subject: fuse-bridge: fuse_thread_proc: avoid realloc-clobber induced leak upon OOM Change-Id: I835d14b702b875bb07f41e157583592df9b72f36 BUG: 846755 Signed-off-by: Jim Meyering Reviewed-on: http://review.gluster.com/3792 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mount/fuse/src/fuse-bridge.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'xlators/mount/fuse/src') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index fc294e7a8..e5fa3a6b6 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"); -- cgit