diff options
author | bapt <bapt@FreeBSD.org> | 2016-01-11 19:26:18 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2016-01-11 19:26:18 +0000 |
commit | 7ba2ab6d8e428a02d986248440f5b140bc6aa1c5 (patch) | |
tree | 55c323d489e3efa6a93288ef203c9746e7ef6539 /usr.sbin/pw | |
parent | d873bf8d211f88245e6e06a3c204a81cc5e197c4 (diff) | |
download | FreeBSD-src-7ba2ab6d8e428a02d986248440f5b140bc6aa1c5.zip FreeBSD-src-7ba2ab6d8e428a02d986248440f5b140bc6aa1c5.tar.gz |
MFC: r290153 (by bdrewery)
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 bb90db3..30a2749 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'; /* |