iovec-util: add missing assertion

This commit is contained in:
Mike Yuan
2023-12-13 20:42:05 +08:00
parent f2ad89248b
commit ba354c164f
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -62,8 +62,10 @@ char* set_iovec_string_field_free(struct iovec *iovec, size_t *n_iovec, const ch
return x;
}
void iovec_array_free(struct iovec *iovec, size_t n) {
FOREACH_ARRAY(i, iovec, n)
void iovec_array_free(struct iovec *iovec, size_t n_iovec) {
assert(iovec || n_iovec == 0);
FOREACH_ARRAY(i, iovec, n_iovec)
free(i->iov_base);
free(iovec);
+1 -1
View File
@@ -41,4 +41,4 @@ static inline bool iovec_is_set(const struct iovec *iovec) {
char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value);
char* set_iovec_string_field_free(struct iovec *iovec, size_t *n_iovec, const char *field, char *value);
void iovec_array_free(struct iovec *iovec, size_t n);
void iovec_array_free(struct iovec *iovec, size_t n_iovec);