]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/mcore/interp.c
sim/mcore/interp.c: Include "unistd.h".
[thirdparty/binutils-gdb.git] / sim / mcore / interp.c
index 72c59f7ecb97bd31f793d8b7bd1e824b6a915d80..7e2be0d3ff51e94e94843ec711a718d45dbeb7fd 100644 (file)
@@ -1,5 +1,5 @@
 /* Simulator for Motorola's MCore processor
-   Copyright (C) 1999-2014 Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions.
 
 This file is part of GDB, the GNU debugger.
@@ -23,6 +23,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/times.h>
 #include <sys/param.h>
 #include <netinet/in.h>        /* for byte ordering macros */
+#include <unistd.h>
 #include "bfd.h"
 #include "gdb/callback.h"
 #include "libiberty.h"
@@ -1922,7 +1923,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_load (sd, prog, abfd, from_tty)
      SIM_DESC sd;
-     char * prog;
+     const char * prog;
      bfd * abfd;
      int from_tty;
 {
@@ -2130,7 +2131,7 @@ sim_kill (sd)
 void
 sim_do_command (sd, cmd)
      SIM_DESC sd;
-     char * cmd;
+     const char *cmd;
 {
   /* Nothing there yet; it's all an error.  */
   
@@ -2143,6 +2144,7 @@ sim_do_command (sd, cmd)
          if ((simargv[1] == NULL) || (simargv[2] == NULL))
            {
              fprintf (stderr, "Error: missing argument to watch cmd.\n");
+             freeargv (simargv);
              return;
            }
          
@@ -2187,6 +2189,8 @@ sim_do_command (sd, cmd)
          fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
                   cmd);
        }
+
+      freeargv (simargv);
     }
   else
     {