From c36cd340ac0037ff75c9c287cf4c82e2f58beb2f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 16 Sep 2018 21:05:35 +0200 Subject: Fix potential memory leak --- raul/Socket.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/raul/Socket.hpp b/raul/Socket.hpp index c42485f..fed58dd 100644 --- a/raul/Socket.hpp +++ b/raul/Socket.hpp @@ -225,8 +225,9 @@ Socket::accept() struct sockaddr* client_addr = (struct sockaddr*)calloc( 1, client_addr_len); - int conn = ::accept(_sock, client_addr, &client_addr_len); + const int conn = ::accept(_sock, client_addr, &client_addr_len); if (conn == -1) { + free(client_addr); return std::shared_ptr(); } -- cgit v1.2.1