diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-08-22 00:49:33 -0400 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-08-22 06:49:33 +0200 |
commit | ed28668392e450bf22fe97e0581a63135498b8c0 (patch) | |
tree | f2590a2bfdbb9e54e386d9f6fa913b9deccf87b8 /src/nvim/charset.c | |
parent | bb50eadc84a4d095b1739ad31720fafe7bca6d0f (diff) | |
download | rneovim-ed28668392e450bf22fe97e0581a63135498b8c0.tar.gz rneovim-ed28668392e450bf22fe97e0581a63135498b8c0.tar.bz2 rneovim-ed28668392e450bf22fe97e0581a63135498b8c0.zip |
vim-patch:8.1.1897: may free memory twice when out of memory (#10827)
Problem: May free memory twice when out of memory.
Solution: Check that backslash_halve_save() returns a different pointer.
(Dominique Pelle, closes vim/vim#4847)
https://github.com/vim/vim/commit/f1552d07d715b437d941659479942c2543b02bd4
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r-- | src/nvim/charset.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 9060a0de82..1dec0beeee 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1900,7 +1900,8 @@ void backslash_halve(char_u *p) /// @param p /// /// @return String with the number of backslashes halved. -char_u* backslash_halve_save(char_u *p) +char_u *backslash_halve_save(const char_u *p) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET { // TODO(philix): simplify and improve backslash_halve_save algorithm char_u *res = vim_strsave(p); |