Mercurial > vim
comparison src/term.c @ 24737:e97a14604f65 v8.2.2907
patch 8.2.2907: memory leak when running out of memory
Commit: https://github.com/vim/vim/commit/28cf44f761a7bf261bcd0760a1c5f61070f69595
Author: Dominique Pelle <dominique.pelle@gmail.com>
Date: Sat May 29 22:34:19 2021 +0200
patch 8.2.2907: memory leak when running out of memory
Problem: Memory leak when running out of memory.
Solution: Free the allocated memory. (Dominique Pell?, closes https://github.com/vim/vim/issues/8284)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 May 2021 22:45:02 +0200 |
parents | 9299d21d1d5d |
children | 7334bf933510 |
comparison
equal
deleted
inserted
replaced
24736:0787d011aa20 | 24737:e97a14604f65 |
---|---|
4246 tc_max_len += 20; | 4246 tc_max_len += 20; |
4247 new_tc = ALLOC_MULT(struct termcode, tc_max_len); | 4247 new_tc = ALLOC_MULT(struct termcode, tc_max_len); |
4248 if (new_tc == NULL) | 4248 if (new_tc == NULL) |
4249 { | 4249 { |
4250 tc_max_len -= 20; | 4250 tc_max_len -= 20; |
4251 vim_free(s); | |
4251 return; | 4252 return; |
4252 } | 4253 } |
4253 for (i = 0; i < tc_len; ++i) | 4254 for (i = 0; i < tc_len; ++i) |
4254 new_tc[i] = termcodes[i]; | 4255 new_tc[i] = termcodes[i]; |
4255 vim_free(termcodes); | 4256 vim_free(termcodes); |