From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0E970DE3 for ; Mon, 12 Jun 2017 23:29:09 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2017 14:29:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,335,1493708400"; d="scan'208";a="98629316" Received: from dverkamp-desk2.ch.intel.com ([143.182.137.94]) by orsmga002.jf.intel.com with ESMTP; 12 Jun 2017 14:29:08 -0700 From: Daniel Verkamp To: dev@dpdk.org Cc: Daniel Verkamp Date: Mon, 12 Jun 2017 14:29:04 -0700 Message-Id: <20170612212904.8787-1-daniel.verkamp@intel.com> X-Mailer: git-send-email 2.9.4 Subject: [dpdk-dev] [PATCH] vhost: clean up per-socket mutex X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jun 2017 21:29:10 -0000 vsocket->conn_mutex was allocated with pthread_mutex_init() but never freed with pthread_mutex_destroy(). This is a potential memory leak, depending on how pthread_mutex_t is implemented. Signed-off-by: Daniel Verkamp --- lib/librte_vhost/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index c7f99b0..9720773 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -636,6 +636,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT); if (vsocket->reconnect && reconn_tid == 0) { if (vhost_user_reconnect_init() < 0) { + pthread_mutex_destroy(&vsocket->conn_mutex); free(vsocket->path); free(vsocket); goto out; @@ -646,6 +647,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) } ret = create_unix_socket(vsocket); if (ret < 0) { + pthread_mutex_destroy(&vsocket->conn_mutex); free(vsocket->path); free(vsocket); goto out; @@ -724,6 +726,7 @@ rte_vhost_driver_unregister(const char *path) } pthread_mutex_unlock(&vsocket->conn_mutex); + pthread_mutex_destroy(&vsocket->conn_mutex); free(vsocket->path); free(vsocket); -- 2.9.4