From 275ffbe471a8901c33d7e16d77616dbda77e8990 Mon Sep 17 00:00:00 2001 From: Virtually Nick Date: Fri, 24 May 2024 15:11:10 -0400 Subject: [PATCH] GUACAMOLE-1686: Fix fd resource leak in WoL code. --- src/libguac/wol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libguac/wol.c b/src/libguac/wol.c index c669dc47..29eb5f50 100644 --- a/src/libguac/wol.c +++ b/src/libguac/wol.c @@ -212,6 +212,9 @@ int guac_wol_wake_and_wait(const char* mac_addr, const char* broadcast_addr, return 0; } + /* Close the fd to avoid resource leak. */ + close(sockfd); + /* Send the magic WOL packet and store return value. */ int retval = guac_wol_wake(mac_addr, broadcast_addr, udp_port); @@ -243,4 +246,4 @@ int guac_wol_wake_and_wait(const char* mac_addr, const char* broadcast_addr, guac_error_message = "Unable to connect to remote host."; return -1; -} \ No newline at end of file +}