From daed0cf9831c07863e5a2a572c2dd242fe757a31 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Mon, 23 Sep 2019 21:16:20 +0200 Subject: [PATCH] utils: fix resource leak Fix resource leak in fw3_lock_path in case flock fails Detected by Coverity in CID 1453962 Signed-off-by: Hans Dedecker --- utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils.c b/utils.c index d9b1f7d..a1cba7e 100644 --- a/utils.c +++ b/utils.c @@ -359,6 +359,7 @@ fw3_lock_path(int *fd, const char *path) if (flock(lock_fd, LOCK_EX)) { warn("Cannot acquire exclusive lock: %s", strerror(errno)); + close(lock_fd); return false; } -- 2.25.1