config_sortlist: (win32) missing else
authorDima Tisnek <dimaqq@gmail.com>
Wed, 16 Feb 2011 22:43:49 +0000 (23:43 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 16 Feb 2011 22:44:36 +0000 (23:44 +0100)
Without an else there, contents of "pat" that could have been
successfully set just above, may be clobbered by successive unsuccessful
calls to "xxx_pton" or "ip_addr".

ares_init.c

index d2f4a72a30a1d5e0d1671759d38944c2aca0dd3c..4c54c86550eaf76290cd6fde732c79a24390f789 100644 (file)
@@ -1292,9 +1292,9 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
           if (!sortlist_alloc(sortlist, nsort, &pat))
             return ARES_ENOMEM;
         }
-      if (ipbufpfx[0] &&
-          (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4,
-                                     sizeof(pat.addrV4))) > 0)
+      else if (ipbufpfx[0] &&
+               (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4,
+                                          sizeof(pat.addrV4))) > 0)
         {
           pat.type = PATTERN_CIDR;
           pat.mask.bits = (unsigned short)bits;