MINOR: http-htx: Use a dedicated function to release http_reply objects
A function to release an http_reply object has been added. It is now called when
an http return rule is released.
diff --git a/src/http_htx.c b/src/http_htx.c
index 2ec3004..4e8ca0b 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -954,6 +954,44 @@
return 0;
}
+void release_http_reply(struct http_reply *http_reply)
+{
+ struct logformat_node *lf, *lfb;
+ struct http_reply_hdr *hdr, *hdrb;
+
+ if (!http_reply)
+ return;
+
+ free(http_reply->ctype);
+ http_reply->ctype = NULL;
+ list_for_each_entry_safe(hdr, hdrb, &http_reply->hdrs, list) {
+ LIST_DEL(&hdr->list);
+ list_for_each_entry_safe(lf, lfb, &hdr->value, list) {
+ LIST_DEL(&lf->list);
+ release_sample_expr(lf->expr);
+ free(lf->arg);
+ free(lf);
+ }
+ istfree(&hdr->name);
+ free(hdr);
+ }
+
+ if (http_reply->type == HTTP_REPLY_ERRFILES) {
+ free(http_reply->body.http_errors);
+ http_reply->body.http_errors = NULL;
+ }
+ else if (http_reply->type == HTTP_REPLY_RAW)
+ chunk_destroy(&http_reply->body.obj);
+ else if (http_reply->type == HTTP_REPLY_LOGFMT) {
+ list_for_each_entry_safe(lf, lfb, &http_reply->body.fmt, list) {
+ LIST_DEL(&lf->list);
+ release_sample_expr(lf->expr);
+ free(lf->arg);
+ free(lf);
+ }
+ }
+}
+
static int http_htx_init(void)
{
struct buffer chk;