From c25eb44aef73095545a733e4d446c6325148caab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 4 Mar 2021 21:22:47 +0100 Subject: [PATCH] sd-bus: avoid alloc and missing oom check in bus_match_dump() --- src/libsystemd/sd-bus/bus-match.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index f624d1ab3c..eb719c0105 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) -- 2.25.1