From: David Tardon Date: Wed, 17 Mar 2021 11:20:11 +0000 (+0100) Subject: journal-upload: make the curl_slist cleanup actually work X-Git-Tag: v248-2~53^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3851069709dbfc4729d206c208f0f773f6fb8da5;p=thirdparty%2Fsystemd.git journal-upload: make the curl_slist cleanup actually work If h is NULL, it is pointless to call curl_slist_free_all() on it... --- diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 9a7a4e92a42..af53f98d133 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -182,23 +182,25 @@ int start_upload(Uploader *u, assert(input_callback); if (!u->header) { - struct curl_slist *h; + struct curl_slist *h, *l; h = curl_slist_append(NULL, "Content-Type: application/vnd.fdo.journal"); if (!h) return log_oom(); - h = curl_slist_append(h, "Transfer-Encoding: chunked"); - if (!h) { + l = curl_slist_append(h, "Transfer-Encoding: chunked"); + if (!l) { curl_slist_free_all(h); return log_oom(); } + h = l; - h = curl_slist_append(h, "Accept: text/plain"); - if (!h) { + l = curl_slist_append(h, "Accept: text/plain"); + if (!l) { curl_slist_free_all(h); return log_oom(); } + h = l; u->header = h; }