sim: Be sure of calling freeargv() after successfully call buildargv().
authorChen Gang <gang.chen.5i5j@gmail.com>
Fri, 30 Jan 2015 22:13:39 +0000 (06:13 +0800)
committerChen Gang <gang.chen.5i5j@gmail.com>
Mon, 2 Feb 2015 20:03:41 +0000 (04:03 +0800)
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.

sim/ChangeLog
sim/microblaze/interp.c

index 628e6a8b09f647ff09d3de20258ae3a25e2b3b97..a891ce51f7b9a2d91b1ff95d192a8f7ad31b8d8c 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
+
+       * microblaze/interp.c (sim_do_command): Call freeargv() before
+       return.
+
 2015-02-02  Chen Gang <gang.chen.5i5j@gmail.com>
 
        * mcore/interp.c (sim_do_command): Call freeargv() before return.
index 1c8a22d1543263f86ed8e3760006af4d78cd6eb6..4fc45952901c6214b84ad9da40cc7ab51732d1fc 100644 (file)
@@ -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
     {
This page took 0.028736 seconds and 4 git commands to generate.