diff options
author | Jim Meyering <meyering@redhat.com> | 2012-08-08 18:42:24 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-19 10:14:31 -0700 |
commit | b757819289b014dbf706b26ca17f6cb584301ffc (patch) | |
tree | 456052b131da67d9ab8d6a9377ed48d5d7934206 /xlators/cluster | |
parent | 7daa85508314838ce8f0c2cb731827d0f92eb5ee (diff) |
cluster/dht: don't leak upon GF_REALLOC failure
Change-Id: I7dfabcc2981df5c5a1e1a54c3135400a60626cd1
BUG: 846755
Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-on: http://review.gluster.com/3798
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index fbe18959a43..4d8d326ec25 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1728,13 +1728,14 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->xattr_val) { plen = strlen (local->xattr_val); if (plen) { + void *p; /* extra byte(s) for \0 to be safe */ alloc_len += (plen + 2); - local->xattr_val = - GF_REALLOC (local->xattr_val, - alloc_len); - if (!local->xattr_val) + p = GF_REALLOC (local->xattr_val, + alloc_len); + if (!p) goto out; + local->xattr_val = p; } strcat (local->xattr_val, value_got); |