ha_freearray() is a new function which free() an array of strings
terminated by a NULL entry.
The pointer to the array will be free and set to NULL.
int path_base(const char *path, const char *base, char *dst, char **err);
+void ha_freearray(char ***array);
+
#endif /* _HAPROXY_TOOLS_H */
return err_code;
}
+/*
+ * free() an array of strings terminated by a NULL entry
+ * set the pointer to NULL
+ */
+void ha_freearray(char ***array)
+{
+ int i;
+ char **r = *array;
+
+ for (i = 0; r && r[i]; i++) {
+ free(r[i]);
+ r[i] = NULL;
+ }
+ *array = NULL;
+}
+
/*
* Local variables:
* c-indent-level: 8