diff options
author | David Tardon <dtardon@redhat.com> | 2021-03-17 10:22:15 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2021-03-18 09:41:49 +0100 |
commit | a6f575a1e88dbc01559091c3cc069f4800e32fe7 (patch) | |
tree | 2a0d028ed23c391cb1dbac9440af37e66e56b6b8 /src/journal-remote | |
parent | c60d95ca4f8dcd42731aadcabca990dad2176063 (diff) | |
download | systemd-a6f575a1e88dbc01559091c3cc069f4800e32fe7.tar.gz |
journal-upload: cleanup CURL* on error
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-upload.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index e56e336b4f..9a7a4e92a4 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -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'; |