diff options
Diffstat (limited to 'xlators/storage/posix/src/posix-metadata.c')
-rw-r--r-- | xlators/storage/posix/src/posix-metadata.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index 62fc328dd3b..99b49ff4458 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -269,6 +269,7 @@ __posix_get_mdata_xattr(xlator_t *this, const char *real_path, int _fd, */ if (stbuf && op_errno != ENOENT) { ret = 0; + GF_FREE(mdata); goto out; } else { /* This case should not be hit. If it hits, @@ -342,6 +343,7 @@ posix_set_mdata_xattr(xlator_t *this, const char *real_path, int fd, posix_mdata_t *mdata = NULL; int ret = -1; int op_errno = 0; + bool free_mdata = false; GF_VALIDATE_OR_GOTO("posix", this, out); GF_VALIDATE_OR_GOTO(this->name, inode, out); @@ -412,6 +414,8 @@ posix_set_mdata_xattr(xlator_t *this, const char *real_path, int fd, mdata->mtime.tv_nsec = time->tv_nsec; __inode_ctx_set1(inode, this, (uint64_t *)&mdata); + } else { + free_mdata = true; } } @@ -485,6 +489,9 @@ out: stbuf->ia_atime_nsec = mdata->atime.tv_nsec; } + if (free_mdata) + GF_FREE(mdata); + return ret; } |