From 70f1280c83ce4cc9f11fa99f1386cdf621e70ee4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 22 Feb 2023 23:13:31 +0100 Subject: tree-wide: use unlink_and_freep() moreover --- src/login/logind-seat.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/login/logind-seat.c') diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 65323f6c92..c92e59ae51 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -13,6 +13,7 @@ #include "fd-util.h" #include "fileio.h" #include "format-util.h" +#include "fs-util.h" #include "logind-seat-dbus.h" #include "logind-seat.h" #include "logind-session-dbus.h" @@ -81,7 +82,7 @@ Seat* seat_free(Seat *s) { } int seat_save(Seat *s) { - _cleanup_free_ char *temp_path = NULL; + _cleanup_(unlink_and_freep) char *temp_path = NULL; _cleanup_fclose_ FILE *f = NULL; int r; @@ -146,14 +147,11 @@ int seat_save(Seat *s) { goto fail; } + temp_path = mfree(temp_path); return 0; fail: (void) unlink(s->state_file); - - if (temp_path) - (void) unlink(temp_path); - return log_error_errno(r, "Failed to save seat data %s: %m", s->state_file); } -- cgit v1.2.1