r2376 - in branches/1.2: . lib/libvarnish

des at projects.linpro.no des at projects.linpro.no
Wed Jan 23 16:50:37 CET 2008


Author: des
Date: 2008-01-23 16:50:37 +0100 (Wed, 23 Jan 2008)
New Revision: 2376

Modified:
   branches/1.2/
   branches/1.2/lib/libvarnish/vss.c
Log:
Merged revisions 2375 via svnmerge from 
svn+ssh://projects.linpro.no/svn/varnish/trunk/varnish-cache

........
  r2375 | des | 2008-01-23 16:45:03 +0100 (Wed, 23 Jan 2008) | 6 lines
  
  Don't assume that res0 != NULL automatically means i == 0.  I can't say for
  sure (without more coffee) that the assumption is incorrect, but it makes
  the code gratuitously non-transparent.
  
  Coverity Scan (CID:8)
........



Property changes on: branches/1.2
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255
   + /trunk/varnish-cache:1-2101,2104-2107,2115-2120,2122-2130,2133,2151,2153-2154,2157,2161-2162,2166-2168,2173,2175-2176,2180-2184,2186-2193,2206,2208,2210-2215,2220,2222-2232,2243,2246-2255,2375

Modified: branches/1.2/lib/libvarnish/vss.c
===================================================================
--- branches/1.2/lib/libvarnish/vss.c	2008-01-23 15:45:03 UTC (rev 2375)
+++ branches/1.2/lib/libvarnish/vss.c	2008-01-23 15:50:37 UTC (rev 2376)
@@ -135,8 +135,13 @@
 		fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(ret));
 		return (0);
 	}
-	for (res = res0, i = 0; res != NULL; res = res->ai_next)
-		++i;
+	XXXAN(res0);
+	for (res = res0, i = 0; res != NULL; res = res->ai_next, ++i)
+		/* nothing */ ;
+	if (i == 0) {
+		freeaddrinfo(res0);
+		return (0);
+	}
 	va = calloc(i, sizeof *va);
 	XXXAN(va);
 	*vap = va;




More information about the varnish-commit mailing list