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/include/proto/http_htx.h b/include/proto/http_htx.h
index 9a70ca5..2307838 100644
--- a/include/proto/http_htx.h
+++ b/include/proto/http_htx.h
@@ -60,6 +60,8 @@
 			       int occ, struct http_hdr_ctx *ctx, char **vptr, size_t *vlen);
 int http_str_to_htx(struct buffer *buf, struct ist raw);
 
+void release_http_reply(struct http_reply *http_reply);
+
 struct buffer *http_load_errorfile(const char *file, char **errmsg);
 struct buffer *http_load_errormsg(const char *key, const struct ist msg, char **errmsg);
 struct buffer *http_parse_errorfile(int status, const char *file, char **errmsg);
diff --git a/src/http_act.c b/src/http_act.c
index 09bed92..04c27ea 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -1804,44 +1804,10 @@
 	return ACT_RET_PRS_OK;
 }
 
-/* Release <.arg.http_return> */
+/* Release <.arg.http_reply> */
 static void release_http_return(struct act_rule *rule)
 {
-	struct logformat_node *lf, *lfb;
-	struct http_reply_hdr *hdr, *hdrb;
-
-	if (!rule->arg.http_reply)
-		return;
-
-	free(rule->arg.http_reply->ctype);
-	rule->arg.http_reply->ctype = NULL;
-	list_for_each_entry_safe(hdr, hdrb, &rule->arg.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 (rule->arg.http_reply->type == HTTP_REPLY_ERRFILES) {
-		free(rule->arg.http_reply->body.http_errors);
-		rule->arg.http_reply->body.http_errors = NULL;
-	}
-	else if (rule->arg.http_reply->type == HTTP_REPLY_RAW)
-		chunk_destroy(&rule->arg.http_reply->body.obj);
-	else if (rule->arg.http_reply->type == HTTP_REPLY_LOGFMT) {
-		list_for_each_entry_safe(lf, lfb, &rule->arg.http_reply->body.fmt, list) {
-			LIST_DEL(&lf->list);
-			release_sample_expr(lf->expr);
-			free(lf->arg);
-			free(lf);
-		}
-	}
-
+	release_http_reply(rule->arg.http_reply);
 	rule->arg.http_reply = NULL;
 }
 
@@ -2387,8 +2353,7 @@
 	free(obj);
 	if (fd >= 0)
 		close(fd);
-	rule->arg.http_reply = reply; /* Set reply to release it */
-	release_http_return(rule);
+	release_http_reply(reply);
 	return ACT_RET_PRS_ERR;
 }
 
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;