net: fix leak of fd in bind() error path
authorJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:29:50 +0000 (11:29 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:29:50 +0000 (11:29 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
engines/net.c

index fcf4b8984cd612d1a25d849f2e295ba3935222cf..d036a581811ac5b945ae074169b90f66f090142f 100644 (file)
@@ -1092,6 +1092,7 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
        }
 
        if (bind(fd, saddr, len) < 0) {
+               close(fd);
                td_verror(td, errno, "bind");
                return 1;
        }