The primary purpose is to call nmount() in a loop with new iovec's so
free_iovec takes arguments by reference and resets their values.
Reviewed by: cem
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8513
va_end(ap);
build_iovec(iov, iovlen, name, strdup(val), (size_t)-1);
}
+
+/*
+ * Free the iovec and reset to NULL with zero length. Useful for calling
+ * nmount in a loop.
+ */
+void
+free_iovec(struct iovec **iov, int *iovlen)
+{
+ int i;
+
+ for (i = 0; i < *iovlen; i++)
+ free((*iov)[i].iov_base);
+ free(*iov);
+}
extern int getmnt_silent;
void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len);
void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...);
+void free_iovec(struct iovec **iovec, int *iovlen);