diff options
author | Zhang Huan <zhanghuan@open-fs.com> | 2018-07-23 15:27:41 +0800 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-07-28 07:21:12 +0000 |
commit | 75300258c42aeb29350ac55beb3360ca208454b5 (patch) | |
tree | 68fe2e6bc2b49e5049c9518ef11c9dc41fc84992 /api/src/glfs.c | |
parent | a6b5ec5cb5e2fb429b51c0d2b064fbd96c9de80c (diff) |
libgfapi: fix memory leak on old volume files
Fix missing free of fs->oldvolfile. This patch uses standard
calloc/realloc to allocate memory for vol file. As by the time fs struct
is destroyed, the THIS->ctx is already gone, that causes invalid memory
access.
Change-Id: I72ae19c76eb16e61f077714f7e52405fee721997
fixes: bz#1607689
Signed-off-by: Zhang Huan <zhanghuan@open-fs.com>
Diffstat (limited to 'api/src/glfs.c')
-rw-r--r-- | api/src/glfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index 6f7b6cde56d..a249534ffef 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -971,6 +971,9 @@ priv_glfs_free_from_ctx (struct glfs *fs) PTHREAD_MUTEX_DESTROY (&fs->upcall_list_mutex, fs->pthread_flags, GLFS_INIT_MUTEX_UPCALL); + if (fs->oldvolfile) + FREE (fs->oldvolfile); + FREE (fs->volname); FREE (fs); |