From: Zbigniew Jędrzejewski-Szmek Date: Fri, 5 Mar 2021 14:16:18 +0000 (+0100) Subject: sd-bus: fix memleak in failure path in bus_match_parse() X-Git-Tag: v248-rc3~42^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8df3f44c90a3e479b717e8cc4bb26c95ebbc5cb0;p=thirdparty%2Fsystemd.git sd-bus: fix memleak in failure path in bus_match_parse() --- diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index eb719c01055..71a6cd1318e 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -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] == '\'';