diff options
author | Varsha Rao <varao@redhat.com> | 2018-06-28 14:28:27 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-06-29 05:06:52 +0000 |
commit | c0e66dddcd8964871e0d574f927684ee7e3c4904 (patch) | |
tree | e589eb131489051f220dc39356a9aac1a77b4a48 /xlators/meta/src | |
parent | 25c1c6e9a2aebd1d5bd96b9b67cf9f7dbaa5bb9e (diff) |
xlators/meta: Fix resource_leak
Free priv to fix the resource_leak coverity issue.
Change-Id: Id116bd2f72332d2f665c25c9ae27241286ac570f
updates: bz#789278
Signed-off-by: Varsha Rao <varao@redhat.com>
Diffstat (limited to 'xlators/meta/src')
-rw-r--r-- | xlators/meta/src/meta.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/xlators/meta/src/meta.c b/xlators/meta/src/meta.c index 7ea01ab147b..4c4d671f59d 100644 --- a/xlators/meta/src/meta.c +++ b/xlators/meta/src/meta.c @@ -226,17 +226,22 @@ mem_acct_init (xlator_t *this) int init (xlator_t *this) { - meta_priv_t *priv = NULL; + meta_priv_t *priv = NULL; + int ret = -1; - priv = GF_CALLOC (sizeof(*priv), 1, gf_meta_mt_priv_t); - if (!priv) - return -1; + priv = GF_CALLOC (sizeof(*priv), 1, gf_meta_mt_priv_t); + if (!priv) + return ret; - GF_OPTION_INIT ("meta-dir-name", priv->meta_dir_name, str, out); + GF_OPTION_INIT ("meta-dir-name", priv->meta_dir_name, str, out); - this->private = priv; + this->private = priv; + ret = 0; out: - return 0; + if (ret) + GF_FREE (priv); + + return ret; } |