File 0750-inet_gethost.c-Fix-potential-memory-leak-found-by-co.patch of Package erlang

From 3b6906378334248cff6882512dd817efa3fa071a Mon Sep 17 00:00:00 2001
From: Kjell Winblad <kjellwinblad@gmail.com>
Date: Thu, 18 Mar 2021 10:29:28 +0100
Subject: [PATCH 10/10] inet_gethost.c: Fix potential memory leak (found by
 code_checker)

---
 erts/etc/common/inet_gethost.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/erts/etc/common/inet_gethost.c b/erts/etc/common/inet_gethost.c
index 54825219b4..961b3288a6 100644
--- a/erts/etc/common/inet_gethost.c
+++ b/erts/etc/common/inet_gethost.c
@@ -1878,7 +1878,8 @@ static int worker_loop(void)
 		DEBUGF(5,("getnameinfo returned %d", error_num));
 		if (error_num) {
 		    error_num = map_netdb_error_ai(error_num);
-		    sa = NULL;
+                    FREE(sa);
+                    sa = NULL;
 		}
 #elif defined(HAVE_GETIPNODEBYADDR) /*#ifdef HAVE_GETNAMEINFO*/
 		struct in6_addr ia;
-- 
2.26.2

openSUSE Build Service is sponsored by