pdump: close client socket on error
authorReshma Pattan <reshma.pattan@intel.com>
Mon, 4 Jul 2016 16:17:29 +0000 (17:17 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 10 Jul 2016 13:06:30 +0000 (15:06 +0200)
Close the client socket before returning on error.

Coverity issue: 127555
Fixes: f3c1829130ac ("pdump: check missing home environment variable")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
lib/librte_pdump/rte_pdump.c

index ee566cb..22ed476 100644 (file)
@@ -677,7 +677,7 @@ pdump_create_client_socket(struct pdump_request *p)
                RTE_LOG(ERR, PDUMP,
                        "Failed to get client socket path: %s:%d\n",
                        __func__, __LINE__);
-               return -1;
+               goto exit;
        }
        addr.sun_family = AF_UNIX;
        addr_len = sizeof(struct sockaddr_un);
@@ -728,6 +728,7 @@ pdump_create_client_socket(struct pdump_request *p)
                ret = server_resp.err_value;
        } while (0);
 
+exit:
        close(socket_fd);
        unlink(addr.sun_path);
        return ret;