Mercurial > vim
diff src/libvterm/src/vterm.c @ 20468:6a25d5086e1d v8.2.0788
patch 8.2.0788: memory leak in libvterm
Commit: https://github.com/vim/vim/commit/deb17451edd65e2af1d155bce0886e856a716591
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 17 23:34:42 2020 +0200
patch 8.2.0788: memory leak in libvterm
Problem: Memory leak in libvterm.
Solution: free tmpbuffer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 May 2020 23:45:04 +0200 |
parents | 9ad473b50471 |
children | 1d595fada804 |
line wrap: on
line diff
--- a/src/libvterm/src/vterm.c +++ b/src/libvterm/src/vterm.c @@ -79,6 +79,13 @@ VTerm *vterm_new_with_allocator(int rows vt->tmpbuffer_len = 64; vt->tmpbuffer = vterm_allocator_malloc(vt, vt->tmpbuffer_len); + if (vt->tmpbuffer == NULL) + { + vterm_allocator_free(vt, vt->parser.strbuffer); + vterm_allocator_free(vt, vt); + vterm_allocator_free(vt, vt->outbuffer); + return NULL; + } return vt; } @@ -93,6 +100,7 @@ void vterm_free(VTerm *vt) vterm_allocator_free(vt, vt->parser.strbuffer); vterm_allocator_free(vt, vt->outbuffer); + vterm_allocator_free(vt, vt->tmpbuffer); vterm_allocator_free(vt, vt); }