@@ -219,10 +219,9 @@ typedef void (*ddwaf_log_cb)(
219219 *
220220 * @return Handle to the WAF instance or NULL on error.
221221 *
222- * @note If config is NULL, default values will be used, including the default
223- * free function (ddwaf_object_free).
224- *
225222 * @note If ruleset is NULL, the diagnostics object will not be initialised.
223+ *
224+ * @note The deallocation of the diagnostics must be made with default allocator.
226225 **/
227226ddwaf_handle ddwaf_init (const ddwaf_object *ruleset, ddwaf_object *diagnostics);
228227
@@ -279,6 +278,7 @@ const char *const *ddwaf_known_actions(const ddwaf_handle handle, uint32_t *size
279278 * Context object to perform matching using the provided WAF instance.
280279 *
281280 * @param handle Handle of the WAF instance containing the ruleset definition. (nonnull)
281+ * @param output Allocator used to serve output objects created during evaluation (nonnull)
282282
283283 * @return Handle to the context instance.
284284 *
@@ -304,6 +304,9 @@ ddwaf_context ddwaf_context_init(const ddwaf_handle handle, ddwaf_allocator outp
304304 * relevant address associated to the value, which can be of an arbitrary
305305 * type.
306306 *
307+ * @param alloc (nullable) Allocator used to free the data provided. If NULL,
308+ * the data will not be freed.
309+ *
307310 * @param result (nullable) Object map containing the following items:
308311 * - events: an array of the generated events.
309312 * - actions: a map of the generated actions in the format:
@@ -318,6 +321,9 @@ ddwaf_context ddwaf_context_init(const ddwaf_handle handle, ddwaf_allocator outp
318321 * This structure must be freed by the caller and will contain all
319322 * specified keys when the value returned by ddwaf_context_eval is either
320323 * DDWAF_OK or DDWAF_MATCH and will be empty otherwise.
324+ * IMPORTANT: This object is not allocated with the allocator
325+ * passed in this call. It uses the allocator given to
326+ * ddwaf_context_init instead.
321327 * @param timeout Maximum time budget in microseconds.
322328 *
323329 * @return Return code of the operation.
@@ -380,6 +386,9 @@ ddwaf_subcontext ddwaf_subcontext_init(ddwaf_context context);
380386 * {string, <value>} in which each key represents the relevant address
381387 * associated to the value, which can be of an arbitrary type.
382388 *
389+ * @param alloc (nullable) Allocator used to free the data provided. If NULL,
390+ * the data will not be freed.
391+ *
383392 * @param result (nullable) Object map containing the following items:
384393 * - events: an array of the generated events.
385394 * - actions: a map of the generated actions in the format:
@@ -394,6 +403,9 @@ ddwaf_subcontext ddwaf_subcontext_init(ddwaf_context context);
394403 * This structure must be freed by the caller and will contain all
395404 * specified keys when the value returned by ddwaf_subcontext_eval is either
396405 * DDWAF_OK or DDWAF_MATCH and will be empty otherwise.
406+ * IMPORTANT: This object is not allocated with the allocator
407+ * passed in this call. It uses the allocator given to
408+ * ddwaf_context_init instead.
397409 * @param timeout Maximum time budget in microseconds.
398410 *
399411 * @return Return code of the operation.
@@ -509,7 +521,7 @@ ddwaf_handle ddwaf_builder_build_instance(ddwaf_builder builder);
509521 * of those matching the filter.
510522 *
511523 * @note This function is not thread-safe and the memory of the paths object must
512- * be freed by the caller.
524+ * be freed by the caller using the default allocator .
513525 **/
514526uint32_t ddwaf_builder_get_config_paths (ddwaf_builder builder, ddwaf_object *paths, const char *filter, uint32_t filter_len);
515527
0 commit comments