sim: Call freeargv() when failure occurs
authorChen Gang <gang.chen.5i5j@gmail.com>
Fri, 30 Jan 2015 21:58:51 +0000 (05:58 +0800)
committerChen Gang <gang.chen.5i5j@gmail.com>
Mon, 2 Feb 2015 20:03:34 +0000 (04:03 +0800)
After successfully call buildargv(), the code need to be sure of calling
freeargv() in any cases.

2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>

       * common/sim-options.c (sim_args_command): Call freeargv() when
       failure occurs.

sim/ChangeLog
sim/common/sim-options.c

index 03c244b36839dd837ded8d2f604f5abcb86a0136..9ddee6482df2317480f1c42cc8ebc0baa9258273 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
+
+       * common/sim-options.c (sim_args_command): Call freeargv() when
+       failure occurs.
+
 2014-07-01  Chen Gang <gang.chen.5i5j@gmail.com>
 
        * sim/microblaze/interp.c: Use long int format instead of int
index c49220e6de6c70a5e8ae3904589478a1810bdedd..814edcf5f22a32a6f3f47c650e271b65721dfa05 100644 (file)
@@ -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.  */
       {