From: Zbigniew Jędrzejewski-Szmek Date: Thu, 4 Mar 2021 20:22:47 +0000 (+0100) Subject: sd-bus: avoid alloc and missing oom check in bus_match_dump() X-Git-Tag: v248-rc3~42^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c25eb44aef73095545a733e4d446c6325148caab;p=thirdparty%2Fsystemd.git sd-bus: avoid alloc and missing oom check in bus_match_dump() --- diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index f624d1ab3ca..eb719c01055 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -1017,14 +1017,12 @@ const char* bus_match_node_type_to_string(enum bus_match_node_type t, char buf[] } void bus_match_dump(FILE *out, struct bus_match_node *node, unsigned level) { - _cleanup_free_ char *pfx = NULL; char buf[32]; if (!node) return; - pfx = strrep(" ", level); - fprintf(out, "%s[%s]", strempty(pfx), bus_match_node_type_to_string(node->type, buf, sizeof(buf))); + fprintf(out, "%*s[%s]", 2 * level, "", bus_match_node_type_to_string(node->type, buf, sizeof(buf))); if (node->type == BUS_MATCH_VALUE) { if (node->parent->type == BUS_MATCH_MESSAGE_TYPE)