[PATCH] libreplace: free() deals fine with NULL pointers

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Jan 24 08:51:14 MST 2014


Hi!

Please review & push!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 287484910220f977824649c6d9029466d9554d02 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 1 Jan 2014 17:56:30 +0100
Subject: [PATCH] libreplace: free() deals fine with NULL pointers

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 lib/replace/getaddrinfo.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/replace/getaddrinfo.c b/lib/replace/getaddrinfo.c
index c5cd52b..8440d8e 100644
--- a/lib/replace/getaddrinfo.c
+++ b/lib/replace/getaddrinfo.c
@@ -321,12 +321,8 @@ void rep_freeaddrinfo(struct addrinfo *res)
 
 	for (;res; res = next) {
 		next = res->ai_next;
-		if (res->ai_canonname) {
-			free(res->ai_canonname);
-		}
-		if (res->ai_addr) {
-			free(res->ai_addr);
-		}
+		free(res->ai_canonname);
+		free(res->ai_addr);
 		free(res);
 	}
 }
-- 
1.7.9.5



More information about the samba-technical mailing list