To: vim-dev@vim.org Subject: Patch 7.0.168 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 7.0.168 Problem: Using uninitialized memory and memory leak. (Dominique Pelle) Solution: Use alloc_clear() instead of alloc() for w_lines. Free b_ml.ml_stack after recovery. Files: src/memline.c, src/window.c *** ../vim-7.0.167/src/memline.c Wed Nov 1 18:10:36 2006 --- src/memline.c Thu Nov 16 22:29:19 2006 *************** *** 1329,1334 **** --- 1329,1335 ---- mf_put(mfp, hp, FALSE, FALSE); mf_close(mfp, FALSE); /* will also vim_free(mfp->mf_fname) */ } + vim_free(buf->b_ml.ml_stack); vim_free(buf); if (serious_error && called_from_main) ml_close(curbuf, TRUE); *** ../vim-7.0.167/src/window.c Tue Oct 24 21:15:09 2006 --- src/window.c Thu Nov 16 22:24:51 2006 *************** *** 4273,4279 **** win_T *wp; { wp->w_lines_valid = 0; ! wp->w_lines = (wline_T *)alloc((unsigned)(Rows * sizeof(wline_T))); if (wp->w_lines == NULL) return FAIL; return OK; --- 4273,4279 ---- win_T *wp; { wp->w_lines_valid = 0; ! wp->w_lines = (wline_T *)alloc_clear((unsigned)(Rows * sizeof(wline_T))); if (wp->w_lines == NULL) return FAIL; return OK; *** ../vim-7.0.167/src/version.c Tue Nov 21 19:36:00 2006 --- src/version.c Tue Nov 21 20:34:13 2006 *************** *** 668,669 **** --- 668,671 ---- { /* Add new patch number below this line */ + /**/ + 168, /**/ -- GALAHAD turns back. We see from his POV the lovely ZOOT standing by him smiling enchantingly and a number of equally delectable GIRLIES draped around in the seductively poulticed room. They look at him smilingly and wave. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///