aboutsummaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-01 09:17:54 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-01 09:17:54 +0200
commit009aeeea2aecbc35399eb74f7f9178e35fdbd754 (patch)
treee5c1369478d507bdea203439576d03b766bdcafa /lib/fstree
parent6a810548bb9ea0f950ad8cf0a2c008e1cd8fcf23 (diff)
Fix alloca'd memory being freed in fstree_from_dir
Most code path that use 'extra' allocate it using calloc/malloc/strdup and then converge into a common path that uses free() on extra. This commit removes a stray one that uses alloca for symlink targets, so we don't free() a stack buffer further down in the common path. Bug found using scan-build. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/fstree_from_dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/fstree/fstree_from_dir.c b/lib/fstree/fstree_from_dir.c
index ea1ebe9..ff9f078 100644
--- a/lib/fstree/fstree_from_dir.c
+++ b/lib/fstree/fstree_from_dir.c
@@ -78,7 +78,7 @@ static int populate_dir(fstree_t *fs, tree_node_t *root)
}
if (S_ISLNK(sb.st_mode)) {
- extra = alloca(sb.st_size + 1);
+ extra = calloc(1, sb.st_size + 1);
if (extra == NULL)
goto fail_rdlink;