From: Chen Gang Date: Fri, 30 Jan 2015 22:13:39 +0000 (+0800) Subject: sim: Be sure of calling freeargv() after successfully call buildargv(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=907c4910c3175ce3e9fc9bfb897527ca241ffd24;p=binutils-gdb.git sim: Be sure of calling freeargv() after successfully call buildargv(). Or there will be memory leak. 2015-02-02 Chen Gang * microblaze/interp.c (sim_do_command): Call freeargv() before return. --- diff --git a/sim/ChangeLog b/sim/ChangeLog index 628e6a8b09f..a891ce51f7b 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,8 @@ +2015-02-02 Chen Gang + + * microblaze/interp.c (sim_do_command): Call freeargv() before + return. + 2015-02-02 Chen Gang * mcore/interp.c (sim_do_command): Call freeargv() before return. diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 1c8a22d1543..4fc45952901 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 {