summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2016-01-11 19:26:18 +0000
committerbapt <bapt@FreeBSD.org>2016-01-11 19:26:18 +0000
commit7ba2ab6d8e428a02d986248440f5b140bc6aa1c5 (patch)
tree55c323d489e3efa6a93288ef203c9746e7ef6539 /usr.sbin/pw
parentd873bf8d211f88245e6e06a3c204a81cc5e197c4 (diff)
downloadFreeBSD-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.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 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';
/*
OpenPOWER on IntegriCloud