From mboxrd@z Thu Jan 1 00:00:00 1970 From: eziegenb Subject: [PATCH] Mem: Fixes small memory leak due to missing free. Date: Tue, 19 May 2015 12:54:35 -0700 Message-ID: <1432065275-26905-1-git-send-email-eziegenb@brocade.com> Mime-Version: 1.0 Content-Type: text/plain To: Return-path: Received: from mx0a-000f0801.pphosted.com (mx0a-000f0801.pphosted.com [67.231.144.122]) by dpdk.org (Postfix) with ESMTP id 32E13592A for ; Tue, 19 May 2015 21:55:23 +0200 (CEST) Received: from pps.filterd (m0048193.ppops.net [127.0.0.1]) by mx0a-000f0801.pphosted.com (8.14.7/8.14.7) with SMTP id t4JJ03sE021703 for ; Tue, 19 May 2015 12:55:21 -0700 Received: from brmwp-exchub02.corp.brocade.com ([208.47.132.227]) by mx0a-000f0801.pphosted.com with ESMTP id 1ug8qw8m3p-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Tue, 19 May 2015 12:55:21 -0700 List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A function in cmdline.c has a return that does not free buf properly. Signed-off-by: eziegenb --- lib/librte_cmdline/cmdline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index e61c4f2..747d3bb 100644 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -192,8 +192,10 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...) va_start(ap, fmt); ret = vsnprintf(buf, BUFSIZ, fmt, ap); va_end(ap); - if (ret < 0) + if (ret < 0){ + free(buf); return; + } if (ret >= BUFSIZ) ret = BUFSIZ - 1; write(cl->s_out, buf, ret); -- 1.7.10.4