telemetry: close socket on connection failure
authorCiara Power <ciara.power@intel.com>
Tue, 12 May 2020 15:29:00 +0000 (16:29 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 19 May 2020 13:05:56 +0000 (15:05 +0200)
The socket fd is now being closed when the connection fails.

Coverity issue: 358444
Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
lib/librte_telemetry/telemetry_legacy.c

index 10b575a..72471cb 100644 (file)
@@ -100,6 +100,7 @@ register_client(const char *cmd __rte_unused, const char *params,
 
        if (connect(fd, (struct sockaddr *)&addrs, sizeof(addrs)) == -1) {
                perror("\nClient connection error\n");
+               close(fd);
                return -1;
        }
        pthread_create(&th, NULL, &legacy_client_handler,