dccp_recv.c: Fix memory leak in dccp_recv_open()
authorAndre Noll <maan@systemlinux.org>
Sun, 11 Feb 2007 23:11:09 +0000 (00:11 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 11 Feb 2007 23:11:09 +0000 (00:11 +0100)
Missing freeaddrinfo().

dccp_recv.c

index 943b828..4883e4a 100644 (file)
@@ -95,9 +95,12 @@ static int dccp_recv_open(struct receiver_node *rn)
        if (ret < 0)
                goto err_out;
        PARA_NOTICE_LOG("connecting to %s:%d\n", conf->host_arg, conf->port_arg);
-       ret = -E_DCCP_CONNECT;
-       if (connect(pdd->fd, ai->ai_addr, ai->ai_addrlen) < 0)
+       ret = connect(pdd->fd, ai->ai_addr, ai->ai_addrlen);
+       freeaddrinfo(ai);
+       if (ret < 0) {
+               ret = -E_DCCP_CONNECT;
                goto err_out;
+       }
        mark_fd_nonblock(pdd->fd);
        return 1;
 err_out: