aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/dirtree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/dirtree.c b/lib/dirtree.c
index 361686aa..85b1a3cf 100644
--- a/lib/dirtree.c
+++ b/lib/dirtree.c
@@ -60,7 +60,9 @@ struct dirtree *dirtree_add_node(struct dirtree *parent, char *name,
error:
if (notdotdot(name)) {
char *path = parent ? dirtree_path(parent, 0) : "";
- perror_msg("%s%s%s",path, parent ? "/" : "", name);
+
+ perror_msg("%s%s%s", path, parent ? "/" : "", name);
+ if (parent) free(path);
}
if (parent) parent->symlink = (char *)1;
free(dt);