From 53cc596ad5031354e4ff95657dc18e4afd9af39f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 18 Mar 2019 17:52:48 +0000 Subject: [PATCH] [Minor] Sigh, another oops --- src/libutil/http_connection.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c index a0623dca93..b82f3c98fd 100644 --- a/src/libutil/http_connection.c +++ b/src/libutil/http_connection.c @@ -1095,6 +1095,10 @@ rspamd_http_connection_new_common (struct rspamd_http_context *ctx, g_assert (error_handler != NULL && finish_handler != NULL); + if (ctx == NULL) { + ctx = rspamd_http_context_default (); + } + conn = g_malloc0 (sizeof (struct rspamd_http_connection)); conn->opts = opts; conn->type = type; @@ -1106,10 +1110,6 @@ rspamd_http_connection_new_common (struct rspamd_http_context *ctx, conn->finished = FALSE; /* Init priv */ - if (ctx == NULL) { - ctx = rspamd_http_context_default (); - } - priv = g_malloc0 (sizeof (struct rspamd_http_connection_private)); conn->priv = priv; priv->ctx = ctx; @@ -1165,6 +1165,10 @@ rspamd_http_connection_new_client (struct rspamd_http_context *ctx, { gint fd; + if (ctx == NULL) { + ctx = rspamd_http_context_default (); + } + if (ctx->http_proxies) { struct upstream *up = rspamd_upstream_get (ctx->http_proxies, RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); -- 2.47.3