diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2015-10-29 18:29:28 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2015-10-29 18:29:28 +0000 |
commit | d7268f1e76677b28d0ebecae94276c34bc8cba54 (patch) | |
tree | bb83c4043959538a63dcdec0600a5085889a8406 /pw | |
parent | 66d9e5fe286aaad023911a859e7b61e780a9740b (diff) | |
download | pw-darwin-d7268f1e76677b28d0ebecae94276c34bc8cba54.tar.gz pw-darwin-d7268f1e76677b28d0ebecae94276c34bc8cba54.tar.zst pw-darwin-d7268f1e76677b28d0ebecae94276c34bc8cba54.zip |
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 'pw')
-rw-r--r-- | pw/pw_user.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 1af8f81..345f642 100644 --- a/pw/pw_user.c +++ b/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'; /* |