diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-01-21 19:19:25 +0900 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:12 +0200 |
commit | 0cef6a6a6bca63f333708793d4d75b5bbc2b5a67 (patch) | |
tree | de1a49baea93aeed221e2a39c74c2fd11de4659d /src/basic/fs-util.c | |
parent | 5316104a4b756b0fa2261f60d41df47dd6e7feeb (diff) |
fs-util: chase_symlinks(): prevent double free
Fixes CID #1385316.
Diffstat (limited to 'src/basic/fs-util.c')
-rw-r--r-- | src/basic/fs-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index eec1fbb37..ebf22ffd8 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -849,8 +849,6 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, if (fd < 0) return -errno; - free(done); - if (flags & CHASE_SAFE) { if (fstat(fd, &st) < 0) return -errno; @@ -861,6 +859,8 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, previous_stat = st; } + free(done); + /* Note that we do not revalidate the root, we take it as is. */ if (isempty(root)) done = NULL; |