From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Ziegenbalg Subject: [PATCH v2] Mem: Fixes small memory leak due to missing free. Date: Tue, 19 May 2015 17:04:55 -0700 Message-ID: <1432080295-8972-1-git-send-email-eziegenb@brocade.com> References: Mime-Version: 1.0 Content-Type: text/plain To: Return-path: Received: from mx0b-000f0801.pphosted.com (mx0b-000f0801.pphosted.com [67.231.152.113]) by dpdk.org (Postfix) with ESMTP id A1F6A58CB for ; Wed, 20 May 2015 02:05:13 +0200 (CEST) Received: from pps.filterd (m0048192.ppops.net [127.0.0.1]) by mx0b-000f0801.pphosted.com (8.14.7/8.14.7) with SMTP id t4JNsYWf031279 for ; Tue, 19 May 2015 17:05:12 -0700 Received: from brmwp-exchub01.corp.brocade.com ([208.47.132.227]) by mx0b-000f0801.pphosted.com with ESMTP id 1ugcd50c0b-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Tue, 19 May 2015 17:05:12 -0700 In-Reply-To: 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" From: eziegenb A function in cmdline.c has a return that does not free buf properly. Signed-off-by: Erik Ziegenbalg --- 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