]> granicus.if.org Git - libevent/commitdiff
sample/https-client: don't try to free uninitialized SSL
authorAzat Khuzhin <a3at.mail@gmail.com>
Wed, 19 Aug 2015 10:22:49 +0000 (13:22 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Wed, 19 Aug 2015 10:23:20 +0000 (13:23 +0300)
sample/https-client.c:459:3: warning: ‘ssl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   SSL_free(ssl);

sample/https-client.c

index 47e4595b0cc302ed8e921c24a344aac17e639cba..9d2c9e35d0ac3b7131a55561d8c422286dd95ab1 100644 (file)
@@ -195,7 +195,7 @@ main(int argc, char **argv)
        int retries = 0;
 
        SSL_CTX *ssl_ctx = NULL;
-       SSL *ssl;
+       SSL *ssl = NULL;
        struct bufferevent *bev;
        struct evhttp_connection *evcon = NULL;
        struct evhttp_request *req;
@@ -455,7 +455,7 @@ cleanup:
 
        if (ssl_ctx)
                SSL_CTX_free(ssl_ctx);
-       if (type == HTTP)
+       if (type == HTTP && ssl)
                SSL_free(ssl);
        EVP_cleanup();
        ERR_free_strings();