]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-upload: make the curl_slist cleanup actually work
authorDavid Tardon <dtardon@redhat.com>
Wed, 17 Mar 2021 11:20:11 +0000 (12:20 +0100)
committerDavid Tardon <dtardon@redhat.com>
Thu, 18 Mar 2021 08:41:49 +0000 (09:41 +0100)
If h is NULL, it is pointless to call curl_slist_free_all() on it...

src/journal-remote/journal-upload.c

index 9a7a4e92a42e50699a61f81a6643f1295b752e41..af53f98d133958b36b3ca2dcb4cb3854209cbd53 100644 (file)
@@ -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;
         }