To: vim-dev@vim.org Subject: Patch 6.0.181 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.181 Problem: When using ":cd dir" memory was leaked. Solution: Free the allocated memory. Also avoid an uninitialized memory read. Files: src/misc2.c *** ../vim60.180/src/misc2.c Thu Nov 1 21:25:14 2001 --- src/misc2.c Mon Feb 4 22:05:55 2002 *************** *** 3540,3546 **** { #ifdef BACKSLASH_IN_FILENAME /* "c:dir" needs "c:" to be expanded, otherwise use current dir */ ! if (path[1] == ':') { char_u drive[3]; --- 3540,3546 ---- { #ifdef BACKSLASH_IN_FILENAME /* "c:dir" needs "c:" to be expanded, otherwise use current dir */ ! if (*path != NUL && path[1] == ':') { char_u drive[3]; *************** *** 4974,4985 **** return mch_chdir((char *)new_dir); #else char_u *dir_name; dir_name = find_directory_in_path(new_dir, (int)STRLEN(new_dir), FNAME_MESS, curbuf->b_ffname); if (dir_name == NULL) return -1; ! return mch_chdir((char *)dir_name); #endif } --- 4974,4988 ---- return mch_chdir((char *)new_dir); #else char_u *dir_name; + int r; dir_name = find_directory_in_path(new_dir, (int)STRLEN(new_dir), FNAME_MESS, curbuf->b_ffname); if (dir_name == NULL) return -1; ! r = mch_chdir((char *)dir_name); ! vim_free(dir_name); ! return r; #endif } *** ../vim60.180/src/version.c Mon Feb 4 22:37:41 2002 --- src/version.c Mon Feb 4 22:38:41 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 181, /**/ -- "You mean there really is an answer?" "Yes! But you're not going to like it!" "Oh do please tell us!" "You're really not going to like it!" "but we MUST know - tell us" "Alright, the answer is...." "yes..." "... is ..." "yes... come on!" "is 42!" (Douglas Adams - The Hitchhiker's Guide to the Galaxy) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///