From 6e22e841afd55125462fbe175c9a0c76344e9334 Mon Sep 17 00:00:00 2001 From: Sharad Binjola Date: Thu, 5 Oct 2023 08:38:28 -0700 Subject: [PATCH] Closed socket in case of no bytes sent --- examples/tv-casting-app/tv-casting-common/src/WakeOnLan.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/tv-casting-app/tv-casting-common/src/WakeOnLan.cpp b/examples/tv-casting-app/tv-casting-common/src/WakeOnLan.cpp index cf44c413a70c03..f41ff184a4a43b 100644 --- a/examples/tv-casting-app/tv-casting-common/src/WakeOnLan.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/WakeOnLan.cpp @@ -75,6 +75,7 @@ CHIP_ERROR SendWakeOnLanPacket(chip::CharSpan * MACAddress) if (bytesSent < 0) { ChipLogError(AppServer, "sendto(): Could not send WoL magic packet"); + close(sockfd); return CHIP_ERROR_INCORRECT_STATE; } ChipLogProgress(AppServer, "Broadcasted WoL magic packet with MACAddress %.*s", 2 * kMACLength, MACAddress->data());