commit 53cc596: [Minor] Sigh, another oops

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Mar 18 17:56:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-18 17:52:48 +0000
URL: https://github.com/rspamd/rspamd/commit/53cc596ad5031354e4ff95657dc18e4afd9af39f

[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 a0623dca9..b82f3c98f 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);


More information about the Commits mailing list