diff options
author | David Tardon <dtardon@redhat.com> | 2021-03-17 13:25:47 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2021-03-18 09:41:49 +0100 |
commit | c4a2d475f12b5d61118e4e54cb3b0663bdcdfbd0 (patch) | |
tree | f63c095ee654cae34e7b844becfad162d0400e9f /src/journal-remote | |
parent | 3851069709dbfc4729d206c208f0f773f6fb8da5 (diff) | |
download | systemd-c4a2d475f12b5d61118e4e54cb3b0663bdcdfbd0.tar.gz |
journal-upload: use _cleanup_ for curl_slist
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-upload.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index af53f98d13..a8f1f7e511 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -72,6 +72,7 @@ static void close_fd_input(Uploader *u); } while (0) DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(CURL*, curl_easy_cleanup, NULL); +DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct curl_slist*, curl_slist_free_all, NULL); static size_t output_callback(char *buf, size_t size, @@ -182,27 +183,24 @@ int start_upload(Uploader *u, assert(input_callback); if (!u->header) { - struct curl_slist *h, *l; + _cleanup_(curl_slist_free_allp) struct curl_slist *h = NULL; + struct curl_slist *l; h = curl_slist_append(NULL, "Content-Type: application/vnd.fdo.journal"); if (!h) return log_oom(); l = curl_slist_append(h, "Transfer-Encoding: chunked"); - if (!l) { - curl_slist_free_all(h); + if (!l) return log_oom(); - } h = l; l = curl_slist_append(h, "Accept: text/plain"); - if (!l) { - curl_slist_free_all(h); + if (!l) return log_oom(); - } h = l; - u->header = h; + u->header = TAKE_PTR(h); } if (!u->easy) { |