aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/makefs/mtree.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-09-03 01:15:23 +0000
committerXin LI <delphij@FreeBSD.org>2015-09-03 01:15:23 +0000
commit65b4f270547e6618baa110619126dcfd3d957268 (patch)
tree334858a45c8eb9c0fc5f50299580e8a4db2b79fc /usr.sbin/makefs/mtree.c
parent7e8f566c0c09e49589c46ccea12510e21a06d2b4 (diff)
downloadsrc-65b4f270547e6618baa110619126dcfd3d957268.tar.gz
src-65b4f270547e6618baa110619126dcfd3d957268.zip
Don't leak 'var'.
Reported by: clang static analyzer
Notes
Notes: svn path=/head/; revision=287417
Diffstat (limited to 'usr.sbin/makefs/mtree.c')
-rw-r--r--usr.sbin/makefs/mtree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c
index 9d396d1a5ecb..8a687bfd5534 100644
--- a/usr.sbin/makefs/mtree.c
+++ b/usr.sbin/makefs/mtree.c
@@ -181,7 +181,7 @@ static char *
mtree_resolve(const char *spec, int *istemp)
{
struct sbuf *sb;
- char *res, *var;
+ char *res, *var = NULL;
const char *base, *p, *v;
size_t len;
int c, error, quoted, subst;
@@ -284,8 +284,10 @@ mtree_resolve(const char *spec, int *istemp)
free(res);
}
free(var);
+ var = NULL;
}
+ free(var);
sbuf_finish(sb);
res = (error == 0) ? strdup(sbuf_data(sb)) : NULL;
sbuf_delete(sb);