From 9bee309757eefeb62ece5312e8cfdb9cda8ade0e Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 19 May 2016 14:06:44 +0300 Subject: [PATCH] Call curl_global_cleanup on error from curl_init --- src/alpm-query.c | 1 - src/aur.c | 3 --- src/util.c | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/alpm-query.c b/src/alpm-query.c index 2bdae26..2edcd2f 100644 --- a/src/alpm-query.c +++ b/src/alpm-query.c @@ -500,7 +500,6 @@ static bool alpm_pkg_get_outofdate (alpm_pkg_t *pkg) { CURL *curl = curl_init (CURL_GLOBAL_SSL); if (!curl) { - curl_global_cleanup (); return false; } diff --git a/src/aur.c b/src/aur.c index ff70e58..215e9c0 100644 --- a/src/aur.c +++ b/src/aur.c @@ -768,9 +768,7 @@ unsigned int aur_request (alpm_list_t **targets, aurrequest_t type) CURL *curl = (strncmp (config.aur_url, "https", strlen ("https")) == 0) ? curl_init (CURL_GLOBAL_SSL) : curl_init (CURL_GLOBAL_NOTHING); - if (!curl) { - curl_global_cleanup (); return 0; } @@ -817,7 +815,6 @@ static char *aur_get_arch (const aurpkg_t *pkg) CURL *curl = curl_init (CURL_GLOBAL_SSL); if (!curl) { - curl_global_cleanup (); return NULL; } diff --git a/src/util.c b/src/util.c index 4ed3345..bd6e9c9 100644 --- a/src/util.c +++ b/src/util.c @@ -1094,6 +1094,7 @@ CURL *curl_init (long flags) CURL *curl = curl_easy_init (); if (!curl) { perror ("curl easy"); + curl_global_cleanup (); return NULL; }