Hi

I built Vim-7.2.284 with -DEXITFREE and I see that memory allocated from
":lmap", ":xmap" and ":menutranslate" is not freed before exiting.

Attached patch fixes it.

It's not severe since it's not a real leak and Vim is no built with -DEXITFREE
by default.  But fixing reduces false alarms when searching for real memory
leaks.

Cheers
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: misc2.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/misc2.c,v
retrieving revision 1.83
diff -c -r1.83 misc2.c
*** misc2.c	3 Nov 2009 15:44:10 -0000	1.83
--- misc2.c	8 Nov 2009 08:54:45 -0000
***************
*** 1005,1013 ****
--- 1005,1018 ----
  # ifdef FEAT_MENU
      /* Clear menus. */
      do_cmdline_cmd((char_u *)"aunmenu *");
+ #  ifdef FEAT_MULTI_LANG
+     do_cmdline_cmd((char_u *)"menutranslate clear");
+ #  endif
  # endif
  
      /* Clear mappings, abbreviations, breakpoints. */
+     do_cmdline_cmd((char_u *)"lmapclear");
+     do_cmdline_cmd((char_u *)"xmapclear");
      do_cmdline_cmd((char_u *)"mapclear");
      do_cmdline_cmd((char_u *)"mapclear!");
      do_cmdline_cmd((char_u *)"abclear");
***************
*** 1282,1288 ****
  
  /*
   * Escape "string" for use as a shell argument with system().
!  * This uses single quotes, except when we know we need to use double qoutes
   * (MS-DOS and MS-Windows without 'shellslash' set).
   * Escape a newline, depending on the 'shell' option.
   * When "do_special" is TRUE also replace "!", "%", "#" and things starting
--- 1287,1293 ----
  
  /*
   * Escape "string" for use as a shell argument with system().
!  * This uses single quotes, except when we know we need to use double quotes
   * (MS-DOS and MS-Windows without 'shellslash' set).
   * Escape a newline, depending on the 'shell' option.
   * When "do_special" is TRUE also replace "!", "%", "#" and things starting
***************
*** 1537,1543 ****
  #if defined(FEAT_VISUALEXTRA) || defined(PROTO)
  /*
   * Copy a character a number of times.
!  * Does not work for multi-byte charactes!
   */
      void
  copy_chars(ptr, count, c)
--- 1542,1548 ----
  #if defined(FEAT_VISUALEXTRA) || defined(PROTO)
  /*
   * Copy a character a number of times.
!  * Does not work for multi-byte characters!
   */
      void
  copy_chars(ptr, count, c)
***************
*** 4260,4266 ****
  	 * or '**76' is transposed to '**N'( 'N' is ASCII value 76).
  	 * For EBCDIC you get different character values.
  	 * If no restrict is given after '**' the default is used.
! 	 * Due to this technic the path looks awful if you print it as a
  	 * string.
  	 */
  	len = 0;
--- 4265,4271 ----
  	 * or '**76' is transposed to '**N'( 'N' is ASCII value 76).
  	 * For EBCDIC you get different character values.
  	 * If no restrict is given after '**' the default is used.
! 	 * Due to this technique the path looks awful if you print it as a
  	 * string.
  	 */
  	len = 0;
***************
*** 4649,4655 ****
  				      && !mch_isdir(stackp->ffs_filearray[i]))
  			    continue;   /* not a directory */
  
! 			/* prepare the filename to be checked for existance
  			 * below */
  			STRCPY(file_path, stackp->ffs_filearray[i]);
  			add_pathsep(file_path);
--- 4654,4660 ----
  				      && !mch_isdir(stackp->ffs_filearray[i]))
  			    continue;   /* not a directory */
  
! 			/* prepare the filename to be checked for existence
  			 * below */
  			STRCPY(file_path, stackp->ffs_filearray[i]);
  			add_pathsep(file_path);
***************
*** 5438,5444 ****
  #if defined(MSWIN) || defined(MSDOS) || defined(OS2)
  	    /* handle "\tmp" as absolute path */
  	    || vim_ispathsep(ff_file_to_find[0])
! 	    /* handle "c:name" as absulute path */
  	    || (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':')
  #endif
  #ifdef AMIGA
--- 5443,5449 ----
  #if defined(MSWIN) || defined(MSDOS) || defined(OS2)
  	    /* handle "\tmp" as absolute path */
  	    || vim_ispathsep(ff_file_to_find[0])
! 	    /* handle "c:name" as absolute path */
  	    || (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':')
  #endif
  #ifdef AMIGA
***************
*** 5681,5687 ****
  		p2 = (char_u *)base + (j + gap) * elm_size;
  		if ((*cmp)((void *)p1, (void *)p2) <= 0)
  		    break;
! 		/* Exchange the elemets. */
  		mch_memmove(buf, p1, elm_size);
  		mch_memmove(p1, p2, elm_size);
  		mch_memmove(p2, buf, elm_size);
--- 5686,5692 ----
  		p2 = (char_u *)base + (j + gap) * elm_size;
  		if ((*cmp)((void *)p1, (void *)p2) <= 0)
  		    break;
! 		/* Exchange the elements. */
  		mch_memmove(buf, p1, elm_size);
  		mch_memmove(p1, p2, elm_size);
  		mch_memmove(p2, buf, elm_size);

Raspunde prin e-mail lui