mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 01:38:16 +00:00
vim-patch:7.4.2128 (#5517)
Problem: Memory leak when saving for undo fails.
Solution: Free allocated memory. (Hirohito Higashi)
1e2258297b
This commit is contained in:

committed by
Justin M. Keyes

parent
2a6c5bb0c4
commit
e350902b7d
@@ -2370,10 +2370,12 @@ do_ecmd (
|
||||
if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) {
|
||||
/* Save all the text, so that the reload can be undone.
|
||||
* Sync first so that this is a separate undo-able action. */
|
||||
u_sync(FALSE);
|
||||
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
|
||||
== FAIL)
|
||||
u_sync(false);
|
||||
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, true)
|
||||
== FAIL) {
|
||||
xfree(new_name);
|
||||
goto theend;
|
||||
}
|
||||
u_unchanged(curbuf);
|
||||
buf_freeall(curbuf, BFA_KEEP_UNDO);
|
||||
|
||||
|
Reference in New Issue
Block a user