Fix uninit-var bug in tcpip_straddr.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 3 Dec 2009 12:36:29 +0000 (13:36 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 3 Dec 2009 12:41:02 +0000 (13:41 +0100)
A local variable ai was uninitialized in the case of getaddrinfo
failing. It is not set to 0 (NULL) as it should. This bug was
introduced in YAZ 3.0.51 when a leak for getaddrinfo resources
was fixed.

src/tcpip.c

index 50c0622..cb2883c 100644 (file)
@@ -423,7 +423,7 @@ void *tcpip_straddr(COMSTACK h, const char *str)
 {
     tcpip_state *sp = (tcpip_state *)h->cprivate;
     const char *port = "210";
-    struct addrinfo *ai;
+    struct addrinfo *ai = 0;
     if (h->protocol == PROTO_HTTP)
         port = "80";
     if (!tcpip_init())