1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

journal-upload: cleanup CURL* on error

This commit is contained in:
David Tardon 2021-03-17 10:22:15 +01:00
parent c60d95ca4f
commit a6f575a1e8

View File

@ -71,6 +71,8 @@ static void close_fd_input(Uploader *u);
} \
} while (0)
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(CURL*, curl_easy_cleanup, NULL);
static size_t output_callback(char *buf,
size_t size,
size_t nmemb,
@ -202,7 +204,7 @@ int start_upload(Uploader *u,
}
if (!u->easy) {
CURL *curl;
_cleanup_(curl_easy_cleanupp) CURL *curl = NULL;
curl = curl_easy_init();
if (!curl)
@ -260,7 +262,7 @@ int start_upload(Uploader *u,
easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1,
LOG_WARNING, );
u->easy = curl;
u->easy = TAKE_PTR(curl);
} else {
/* truncate the potential old error message */
u->error[0] = '\0';