From patchwork Tue May 19 19:54:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: eziegenb X-Patchwork-Id: 4805 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 552329A9E; Tue, 19 May 2015 21:55:24 +0200 (CEST) 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 Received: from BRMWP-EXMB11.corp.brocade.com (172.16.59.77) by BRMWP-EXCHUB02.corp.brocade.com (172.16.187.99) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 19 May 2015 13:54:46 -0600 Received: from wheezy.wheezy (10.120.22.182) by BRMWP-EXMB11.corp.brocade.com (172.16.59.77) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 19 May 2015 13:54:44 -0600 From: eziegenb To: Date: Tue, 19 May 2015 12:54:35 -0700 Message-ID: <1432065275-26905-1-git-send-email-eziegenb@brocade.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-ClientProxiedBy: hq1wp-excas12.corp.brocade.com (10.70.38.22) To BRMWP-EXMB11.corp.brocade.com (172.16.59.77) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-05-19_07:2015-05-19, 2015-05-19, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=3 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1505190239 Subject: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 Acked-by: Stephen Hemminger Acked-by: John McNamara --- 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);