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>
This commit is contained in:
parent
bbe02d77a5
commit
d2b0a016e7
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user