From 2d2d1fbb201ea81a54d9c9aef28345cb259eb141 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Sun, 12 Jul 2015 12:29:12 +0200 Subject: dict: dict_set_bin() should never free the pointer on error dict_set_bin() is handling the pointer that it passed inconsistently. Depending on the errors that can occur, the pointer passed to the dict can be free'd, but there is no guarantee. It is cleaner to have the caller free the pointer that allocated it and dict_set_bin() returned an error. When dict_set_bin() returned success, the given pointer will be free'd when dict_unref() calls data_destroy(). Many callers of dict_set_bin() already take care of free'ing the pointer on error. The ones that did not, are corrected with this change too. Change-Id: I39a4f7ebc0cae6d403baba99307d7ce408f25966 BUG: 1242280 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/11638 Tested-by: Gluster Build System Reviewed-by: jiffin tony Thottan Reviewed-by: Raghavendra G Tested-by: NetBSD Build System --- xlators/system/posix-acl/src/posix-acl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'xlators/system') diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index b1d3df396fb..f4527c3b0c8 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -659,6 +659,7 @@ posix_acl_inherit (xlator_t *this, loc_t *loc, dict_t *params, mode_t mode, size_access); if (ret) { gf_log (this->name, GF_LOG_ERROR, "out of memory"); + GF_FREE (xattr_access); ret = -1; goto out; } @@ -682,6 +683,7 @@ posix_acl_inherit (xlator_t *this, loc_t *loc, dict_t *params, mode_t mode, size_default); if (ret) { gf_log (this->name, GF_LOG_ERROR, "out of memory"); + GF_FREE (xattr_default); ret = -1; goto out; } -- cgit