chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5316104
)
fs-util: chase_symlinks(): prevent double free
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Sun, 21 Jan 2018 10:19:25 +0000
(19:19 +0900)
committer
Sven Eden
<yamakuzure@gmx.net>
Wed, 30 May 2018 05:50:12 +0000
(07:50 +0200)
Fixes CID #
1385316
.
src/basic/fs-util.c
patch
|
blob
|
history
diff --git
a/src/basic/fs-util.c
b/src/basic/fs-util.c
index eec1fbb37a0f10bc3566ec0ee06ca410d717ee2c..ebf22ffd8e8f9feb6e24206d21f54bb599bb4207 100644
(file)
--- 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;