summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-29 18:29:28 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-29 18:29:28 +0000
commitef07697d650ba6fcbdd3fcc6c719a076958eab2b (patch)
tree432bdd3a0aabf105c5959cafbaa54e7480b46420 /usr.sbin/pw
parent3d8826f0c92bd029884e1badf0a961aee2aca333 (diff)
downloadFreeBSD-src-ef07697d650ba6fcbdd3fcc6c719a076958eab2b.zip
FreeBSD-src-ef07697d650ba6fcbdd3fcc6c719a076958eab2b.tar.gz
Fix unlikely memory leak.
It is unlikely since the first check in the function is that dir[0] is '/', but later code changes may make it real. Coverity CID: 1332104
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r--usr.sbin/pw/pw_user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c
index 1af8f81..345f642 100644
--- a/usr.sbin/pw/pw_user.c
+++ b/usr.sbin/pw/pw_user.c
@@ -107,8 +107,10 @@ mkdir_home_parents(int dfd, const char *dir)
errx(EX_UNAVAILABLE, "out of memory");
tmp = strrchr(dirs, '/');
- if (tmp == NULL)
+ if (tmp == NULL) {
+ free(dirs);
return;
+ }
tmp[0] = '\0';
/*
OpenPOWER on IntegriCloud