From b9e434be486bbd63d546e27c1ba67cc941d651d2 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 5 Jun 2024 15:17:07 +0200 Subject: [PATCH] [core,peer] check return of setsockopt --- libfreerdp/core/peer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index fba928183..c083a87ec 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -1456,7 +1456,10 @@ freerdp_peer* freerdp_peer_new(int sockfd) option_len = sizeof(option_value); if (sockfd >= 0) - setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (void*)&option_value, option_len); + { + if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (void*)&option_value, option_len) < 0) + goto fail; + } if (client) { @@ -1487,6 +1490,10 @@ freerdp_peer* freerdp_peer_new(int sockfd) } return client; + +fail: + freerdp_peer_free(client); + return NULL; } void freerdp_peer_free(freerdp_peer* client)