]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: http-client: Avoid dead code when compiled without SSL support
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 14 Apr 2022 10:02:34 +0000 (12:02 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 14 Apr 2022 10:02:35 +0000 (12:02 +0200)
When an HTTP client is started on an HAProxy compiled without the SSL
support, an error is triggered when HTTPS is used. In this case, the freshly
created conn-stream is released. But this code is specific to the non-SSL
part. Thus it is moved the in right #if/#else section.

This patch should fix the issue #1655.

src/http_client.c

index 23b8dc89a46e74c73e2d36d44fa8247432ebdb3e..f1e5345a65ba1f0c03771c612cca6d4eb1a0fe9f 100644 (file)
@@ -519,7 +519,11 @@ struct appctx *httpclient_start(struct httpclient *hc)
                        s->target = &httpclient_srv_ssl->obj_type;
 #else
                        ha_alert("httpclient: OpenSSL is not available %s:%d.\n", __FUNCTION__, __LINE__);
-                       goto out_free_stream;
+                       cs_detach_app(cs);
+                       LIST_DELETE(&s->list);
+                       pool_free(pool_head_stream, s);
+                       cs_free(cs);
+                       goto out_free_addr;
 #endif
                        break;
        }
@@ -544,11 +548,6 @@ struct appctx *httpclient_start(struct httpclient *hc)
 
        return appctx;
 
-out_free_stream:
-       cs_detach_app(cs);
-       LIST_DELETE(&s->list);
-       pool_free(pool_head_stream, s);
-       cs_free(cs);
 out_free_addr:
        sockaddr_free(&addr);
 out_free_sess: