]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Sigh, another oops
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Mar 2019 17:52:48 +0000 (17:52 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 18 Mar 2019 17:52:48 +0000 (17:52 +0000)
src/libutil/http_connection.c

index a0623dca931fae47c48d9b890f18e479da7888da..b82f3c98fd49ba9b1dea78a1a218332bf698f7e6 100644 (file)
@@ -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);