git: 5fa183f02845 - main - mountd: use free_iovec for build_iovec cleanup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Apr 2025 15:58:19 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=5fa183f02845f2f74a95efba395d0839a380fa66 commit 5fa183f02845f2f74a95efba395d0839a380fa66 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2025-04-25 15:56:20 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2025-04-25 15:57:24 +0000 mountd: use free_iovec for build_iovec cleanup Remove the handrolled cleanups and use free_iovec instead. No functional change intended. Logically, the change does remove one dead store to iovlen in get_exportlist(). Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D49953 --- usr.sbin/mountd/mountd.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 3c4e5e742c93..2969edd8aed5 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -2099,19 +2099,7 @@ get_exportlist(int passno) syslog(LOG_ERR, "NFSv4 requires at least one V4: line"); } - if (iov != NULL) { - /* Free strings allocated by strdup() in getmntopts.c */ - free(iov[0].iov_base); /* fstype */ - free(iov[2].iov_base); /* fspath */ - free(iov[4].iov_base); /* from */ - free(iov[6].iov_base); /* update */ - free(iov[8].iov_base); /* export */ - free(iov[10].iov_base); /* errmsg */ - - /* free iov, allocated by realloc() */ - free(iov); - iovlen = 0; - } + free_iovec(&iov, &iovlen); /* * If there was no public fh, clear any previous one set. @@ -3409,18 +3397,7 @@ skip: if (cp) *cp = savedc; error_exit: - /* free strings allocated by strdup() in getmntopts.c */ - if (iov != NULL) { - free(iov[0].iov_base); /* fstype */ - free(iov[2].iov_base); /* fspath */ - free(iov[4].iov_base); /* from */ - free(iov[6].iov_base); /* update */ - free(iov[8].iov_base); /* export */ - free(iov[10].iov_base); /* errmsg */ - - /* free iov, allocated by realloc() */ - free(iov); - } + free_iovec(&iov, &iovlen); return (ret); }