diff options
author | Rob Landley <rob@landley.net> | 2014-07-21 19:55:06 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-07-21 19:55:06 -0500 |
commit | 280bb5942526c06211185144a5cdb4c5d05aa2f6 (patch) | |
tree | fbcb3899e2c9bc59f03dda0cf5bcaa2fe24a9cb0 | |
parent | 31db579265fa9e0acea036faa486be26f508e67a (diff) | |
download | toybox-280bb5942526c06211185144a5cdb4c5d05aa2f6.tar.gz |
Fix memory leak in error path.
-rw-r--r-- | lib/dirtree.c | 4 |
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); |