diff options
author | Christopher R. Hertel <crh@redhat.com> | 2014-01-27 14:52:37 -0600 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-02-03 17:22:15 -0800 |
commit | d2b0a016e713aea8920abe23f6113517d78e260a (patch) | |
tree | 88e4d5d174b0c09fbceb9cbf531f9f6f67cbd246 /xlators/cluster | |
parent | bbe02d77a5e7fb587787b9bbc06d28ca8419afb3 (diff) |
cluster/dht: Abandoned memory if a call fails
If the call to dict_set_dynstr() fails, the memory indicated by
xattr_buf will not have been stored in the dictionary, so it must be
freed.
Patch set 2: Added a missed call to GF_FREE(). Fixed a formatting
consistency issue.
Patch set 3: Cleaned a minor style nit.
BUG: 789278
CID: 1124786
Change-Id: Id1f85bd2cbfac0b8727a3f6901f0a50ba921817d
Signed-off-by: Christopher R. Hertel <crh@redhat.com>
Reviewed-on: http://review.gluster.org/6826
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
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 | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 959afe8738c..aba56723353 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1843,10 +1843,13 @@ dht_vgetxattr_fill_and_set (dht_local_t *local, dict_t **dict, xlator_t *this, } else { gf_log (this->name, GF_LOG_WARNING, "Unknown local->xsel (%s)", local->xsel); + GF_FREE (xattr_buf); goto out; } ret = dict_set_dynstr (*dict, local->xsel, xattr_buf); + if (ret) + GF_FREE (xattr_buf); GF_FREE (local->xattr_val); out: |