summaryrefslogtreecommitdiffstats
path: root/src/libvterm
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-17 23:34:42 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-17 23:34:42 +0200
commitdeb17451edd65e2af1d155bce0886e856a716591 (patch)
treec6db8d4961563210c3706b79ce2c15397e99d8ab /src/libvterm
parenta2e408f5981b4da64426c3bda98d837ea36469bf (diff)
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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libvterm/src/vterm.c b/src/libvterm/src/vterm.c
index 7b06c04bbc..991286ee90 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);
}