]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-json: Use goto finish instead of return
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 8 Aug 2024 12:14:53 +0000 (14:14 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 14 Aug 2024 12:18:40 +0000 (14:18 +0200)
sd_json_buildv() uses a "finish" goto label for cleanup so make sure
we goto that label on failure instead of returning directly.

src/libsystemd/sd-json/sd-json.c

index 98ffe4db5482b31bdb0c16aa01cb54b80e18e1cf..835ba56bedf0c9bfb0e71511b653573b07f32cd3 100644 (file)
@@ -4098,7 +4098,7 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
                                                         SD_JSON_BUILD_PAIR("realtime", SD_JSON_BUILD_UNSIGNED(ts->realtime)),
                                                         SD_JSON_BUILD_PAIR("monotonic", SD_JSON_BUILD_UNSIGNED(ts->monotonic)));
                                         if (r < 0)
-                                                return r;
+                                                goto finish;
                                 } else
                                         add = JSON_VARIANT_MAGIC_NULL;
                         }