1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-02 04:22:02 +03:00

sanlock: fix file descriptor leak in error path

Add proper cleanup of file descriptor in the error handling path
to prevent resource leaks when sanlock operations fail.
This commit is contained in:
Zdenek Kabelac
2025-07-10 15:13:18 +02:00
parent b86b1da80a
commit f82c46e673

View File

@ -323,8 +323,11 @@ static int read_host_id_file(void)
break;
}
}
_fclose(file, (char *)daemon_host_id_file);
out:
if (file)
_fclose(file, (char *)daemon_host_id_file);
log_debug("host_id %d from %s", host_id, daemon_host_id_file);
return host_id;
}