diff options
author | Chen Gang <gang.chen.5i5j@gmail.com> | 2015-01-31 06:13:39 +0800 |
---|---|---|
committer | Chen Gang <gang.chen.5i5j@gmail.com> | 2015-02-03 04:03:41 +0800 |
commit | 907c4910c3175ce3e9fc9bfb897527ca241ffd24 (patch) | |
tree | 813e719a9ed4b17f31adc2ba26becb19d9c92adb /sim/microblaze/interp.c | |
parent | cd71915c7738f0992daefe0320b10e3b1960535c (diff) | |
download | gdb-907c4910c3175ce3e9fc9bfb897527ca241ffd24.zip gdb-907c4910c3175ce3e9fc9bfb897527ca241ffd24.tar.gz gdb-907c4910c3175ce3e9fc9bfb897527ca241ffd24.tar.bz2 |
sim: Be sure of calling freeargv() after successfully call buildargv().
Or there will be memory leak.
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
* microblaze/interp.c (sim_do_command): Call freeargv() before
return.
Diffstat (limited to 'sim/microblaze/interp.c')
-rw-r--r-- | sim/microblaze/interp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 1c8a22d..4fc4595 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -1019,6 +1019,7 @@ sim_do_command (SIM_DESC sd, const char *cmd) if ((simargv[1] == NULL) || (simargv[2] == NULL)) { fprintf (stderr, "Error: missing argument to watch cmd.\n"); + freeargv (simargv); return; } @@ -1062,6 +1063,8 @@ sim_do_command (SIM_DESC sd, const char *cmd) fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n", cmd); } + + freeargv (simargv); } else { |