diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2015-10-29 18:29:28 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2015-10-29 18:29:28 +0000 |
commit | ef07697d650ba6fcbdd3fcc6c719a076958eab2b (patch) | |
tree | 432bdd3a0aabf105c5959cafbaa54e7480b46420 /usr.sbin/pw | |
parent | 3d8826f0c92bd029884e1badf0a961aee2aca333 (diff) | |
download | FreeBSD-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.c | 4 |
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'; /* |