From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14770 invoked by alias); 30 Jan 2015 22:57:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14732 invoked by uid 89); 30 Jan 2015 22:57:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: out1134-250.mail.aliyun.com Received: from out1134-250.mail.aliyun.com (HELO out1134-250.mail.aliyun.com) (42.120.134.250) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Jan 2015 22:57:20 +0000 X-Alimail-AntiSpam:AC=CONTINUE;BC=0.5007502|-1;FP=0|0|0|0|0|-1|-1|-1;HT=r41f05021;MF=gang.chen@sunrus.com.cn;PH=DS;RN=1;RT=1;SR=0; Received: from ShengShiZhuChengdeMacBook-Pro.local(mailfrom:gang.chen@sunrus.com.cn ip:223.72.65.1) by smtp.aliyun-inc.com(10.147.11.251); Sat, 31 Jan 2015 06:57:05 +0800 Message-ID: <54CC0E12.2010706@sunrus.com.cn> Date: Sat, 31 Jan 2015 08:57:00 -0000 From: Chen Gang S User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] sim: Call freeargv() when failure occurs Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-01/txt/msg00806.txt.bz2 After successfully call buildargv(), the code need to be sure of calling freeargv() in any cases. 2015-01-31 Chen Gang * common/sim-options.c (sim_args_command): Call freeargv() when failure occurs. --- sim/ChangeLog | 5 +++++ sim/common/sim-options.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sim/ChangeLog b/sim/ChangeLog index 03c244b..7153c6a 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,8 @@ +2014-01-31 Chen Gang + + * common/sim-options.c (sim_args_command): Call freeargv() when + failure occurs. + 2014-07-01 Chen Gang * sim/microblaze/interp.c: Use long int format instead of int diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index c49220e..814edcf 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -993,7 +993,10 @@ sim_args_command (SIM_DESC sd, const char *cmd) sim_cpu *cpu; if (argv [0] == NULL) - return SIM_RC_OK; /* FIXME - perhaps help would be better */ + { + freeargv (argv); + return SIM_RC_OK; /* FIXME - perhaps help would be better */ + } /* First check for a cpu selector. */ { -- 1.9.3