[9816] in Athena Bugs

home help back first fref pref prev next nref lref last post

memory leak in libss.a

daemon@ATHENA.MIT.EDU (lwvanels@Athena.MIT.EDU)
Thu Aug 20 14:45:46 1992

From: lwvanels@Athena.MIT.EDU
Date: Thu, 20 Aug 92 14:45:38 -0400
To: bugs@Athena.MIT.EDU
Reply-To: lwvanels@MIT.EDU

There is a memory leak in the ss_execute_line() function; ss_parse returns a
pointer to allocated memory, but it is never freed.  The following patch
fixes the problem:

diff -c -r1.1 execute_cmd.c
*** 1.1 1992/08/20 18:35:53
--- execute_cmd.c       1992/08/20 18:42:27
***************
*** 193,198 ****
--- 193,199 ----
  {
      char **argv;
      int argc;
+     int retval;

      /* flush leading whitespace */
      while (line_ptr[0] == ' ' || line_ptr[0] == '\t')
***************
*** 215,219 ****
          return 0;

      /* look it up in the request tables, execute if found */
!     return really_execute_command (sci_idx, argc, &argv);
  }
--- 216,222 ----
          return 0;

      /* look it up in the request tables, execute if found */
!     retval = really_execute_command (sci_idx, argc, &argv);
!     free(argv);
!     return(retval);
  }

home help back first fref pref prev next nref lref last post