]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: fix memleak in failure path in bus_match_parse()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 Mar 2021 14:16:18 +0000 (15:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 6 Mar 2021 08:32:18 +0000 (09:32 +0100)
src/libsystemd/sd-bus/bus-match.c

index eb719c01055d58a50a2d4bf7403baed5d98c5cd5..71a6cd1318e4dab4fc17f7eeee2e738da19467f8 100644 (file)
@@ -733,12 +733,16 @@ int bus_match_parse(
                 p += strspn(p, " ");
 
                 eq = strchr(p, '=');
-                if (!eq)
-                        return -EINVAL;
+                if (!eq) {
+                        r = -EINVAL;
+                        goto fail;
+                }
 
                 t = bus_match_node_type_from_string(p, eq - p);
-                if (t < 0)
-                        return -EINVAL;
+                if (t < 0) {
+                        r = -EINVAL;
+                        goto fail;
+                }
 
                 quoted = eq[1] == '\'';