diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-17 23:34:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-17 23:34:42 +0200 |
commit | deb17451edd65e2af1d155bce0886e856a716591 (patch) | |
tree | c6db8d4961563210c3706b79ce2c15397e99d8ab /src/libvterm | |
parent | a2e408f5981b4da64426c3bda98d837ea36469bf (diff) | |
download | vim-git-deb17451edd65e2af1d155bce0886e856a716591.tar.gz |
patch 8.2.0788: memory leak in libvtermv8.2.0788
Problem: Memory leak in libvterm.
Solution: free tmpbuffer.
Diffstat (limited to 'src/libvterm')
-rw-r--r-- | src/libvterm/src/vterm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c index 7b06c04bb..991286ee9 100644 --- a/src/libvterm/src/vterm.c +++ b/src/libvterm/src/vterm.c @@ -79,6 +79,13 @@ VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *fun 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); } |