diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-03-22 04:50:07 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-22 04:54:59 -0700 |
commit | 95f59725adbefd574cfd694dc101ee9c803f167a (patch) | |
tree | 1d7737cb98796ba62c7172fe302192176185b793 /xlators | |
parent | a4233a41bf6a2f9ddbce15a530b1678c55ba24a5 (diff) |
free priv structure if something fails in init for locks
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 2346 (Log message enhancements in GlusterFS - phase 1)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/locks/src/posix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 7b72e9ee7..67f026b16 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -1799,11 +1799,12 @@ init (xlator_t *this) xlator_list_t *trav = NULL; data_t *mandatory = NULL; data_t *trace = NULL; + int ret = -1; if (!this->children || this->children->next) { gf_log (this->name, GF_LOG_CRITICAL, "FATAL: posix-locks should have exactly one child"); - return -1; + goto out; } if (!this->parents) { @@ -1819,7 +1820,7 @@ init (xlator_t *this) gf_log (this->name, GF_LOG_CRITICAL, "'locks' translator is not loaded over a storage " "translator"); - return -1; + goto out;; } priv = GF_CALLOC (1, sizeof (*priv), @@ -1836,12 +1837,19 @@ init (xlator_t *this) &priv->trace) == -1) { gf_log (this->name, GF_LOG_ERROR, "'trace' takes on only boolean values."); - return -1; + goto out; } } this->private = priv; - return 0; + ret = 0; + +out: + if (ret) { + if (priv) + GF_FREE (priv); + } + return ret; } |