From bfa81c0dddd4c19ea44f685add6cc30abdf37447 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 12 Sep 2025 12:46:55 +0200 Subject: [PATCH] Fixed file descriptor leak when creating the am_policy_hub file Changelog: Title Signed-off-by: Lars Erik Wik --- libpromises/bootstrap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpromises/bootstrap.c b/libpromises/bootstrap.c index 58e40fdccc..e79a92294a 100644 --- a/libpromises/bootstrap.c +++ b/libpromises/bootstrap.c @@ -215,12 +215,14 @@ bool WriteAmPolicyHubFile(bool am_policy_hub) { if (!GetAmPolicyHub()) { - if (creat(filename, 0600) == -1) + int fd = creat(filename, 0600); + if (fd == -1) { Log(LOG_LEVEL_ERR, "Error writing marker file '%s'", filename); free(filename); return false; } + close(fd); } } else