svn commit: trunk/uClibc/libc/inet

vapier at uclibc.org vapier at uclibc.org
Fri Sep 28 20:42:27 UTC 2007


Author: vapier
Date: 2007-09-28 13:42:24 -0700 (Fri, 28 Sep 2007)
New Revision: 20097

Log:
do not check the pointer before freeing it since free(NULL) works just fine

Modified:
   trunk/uClibc/libc/inet/resolv.c


Changeset:
Modified: trunk/uClibc/libc/inet/resolv.c
===================================================================
--- trunk/uClibc/libc/inet/resolv.c	2007-09-28 20:39:18 UTC (rev 20096)
+++ trunk/uClibc/libc/inet/resolv.c	2007-09-28 20:42:24 UTC (rev 20097)
@@ -989,10 +989,8 @@
  fail:
 	if (fd != -1)
 		close(fd);
-	if (lookup)
-		free(lookup);
-	if (packet)
-		free(packet);
+	free(lookup);
+	free(packet);
 	h_errno = NETDB_INTERNAL;
 	/* Mess with globals while under lock */
 	if (local_ns != -1) {
@@ -1252,12 +1250,10 @@
 	if (a.atype == type) { /* CNAME*/
 		int len = MIN(anslen, i);
 		memcpy(answer, packet, len);
-		if (packet)
-			free(packet);
+		free(packet);
 		return(len);
 	}
-	if (packet)
-		free(packet);
+	free(packet);
 	return i;
 }
 libc_hidden_def(res_query)




More information about the uClibc-cvs mailing list