summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd/sd-bus/bus-match.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c
index db8da6ee12..2a3e7039a7 100644
--- a/src/libsystemd/sd-bus/bus-match.c
+++ b/src/libsystemd/sd-bus/bus-match.c
@@ -846,7 +846,7 @@ fail:
}
char *bus_match_to_string(struct bus_match_component *components, unsigned n_components) {
- char *buffer = NULL;
+ _cleanup_free_ char *buffer = NULL;
size_t size = 0;
int r;
@@ -855,7 +855,7 @@ char *bus_match_to_string(struct bus_match_component *components, unsigned n_com
assert(components);
- _cleanup_fclose_ FILE *f = open_memstream_unlocked(&buffer, &size);
+ FILE *f = open_memstream_unlocked(&buffer, &size);
if (!f)
return NULL;
@@ -878,10 +878,10 @@ char *bus_match_to_string(struct bus_match_component *components, unsigned n_com
}
r = fflush_and_check(f);
+ safe_fclose(f);
if (r < 0)
return NULL;
-
- return buffer;
+ return TAKE_PTR(buffer);
}
int bus_match_add(