From 428f36e5dd8f2a45ea5795fb9f35dd27a776e3a8 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 3 Apr 2019 23:22:54 +0300 Subject: [PATCH] https-client: do not try to free not initialized base Otherwise: $ https-client --help Syntax: https-client -url [-data data-file.bin] [-ignore-cert] [-retries num] [-timeout sec] [-crt crt] Example: https-client -url https://ip.appspot.com/ [warn] event_base_free_: no base to free --- sample/https-client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sample/https-client.c b/sample/https-client.c index 4292f094..5869974f 100644 --- a/sample/https-client.c +++ b/sample/https-client.c @@ -45,7 +45,6 @@ #include "openssl_hostname_validation.h" -static struct event_base *base; static int ignore_cert = 0; static void @@ -188,7 +187,7 @@ int main(int argc, char **argv) { int r; - + struct event_base *base = NULL; struct evhttp_uri *http_uri = NULL; const char *url = NULL, *data_file = NULL; const char *crt = NULL; @@ -483,7 +482,8 @@ cleanup: evhttp_connection_free(evcon); if (http_uri) evhttp_uri_free(http_uri); - event_base_free(base); + if (base) + event_base_free(base); if (ssl_ctx) SSL_CTX_free(ssl_ctx); -- 2.50.1