From d2b0a016e713aea8920abe23f6113517d78e260a Mon Sep 17 00:00:00 2001 From: "Christopher R. Hertel" Date: Mon, 27 Jan 2014 14:52:37 -0600 Subject: 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 Reviewed-on: http://review.gluster.org/6826 Reviewed-by: Shyamsundar Ranganathan Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-common.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'xlators/cluster/dht/src') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 959afe873..aba567233 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: -- cgit