diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index e8184ff661..e4cc0926f7 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -133,6 +133,10 @@ static int open_watchdog(void) { fn = !watchdog_device || path_equal(watchdog_device, "/dev/watchdog") ? "/dev/watchdog0" : watchdog_device; + r = free_and_strdup(&watchdog_device, fn); + if (r < 0) + return log_oom_debug(); + watchdog_fd = open(fn, O_WRONLY|O_CLOEXEC); if (watchdog_fd < 0) return log_debug_errno(errno, "Failed to open watchdog device %s, ignoring: %m", fn);