changeset 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 d2d2b97ec133
children 327507143c7f
files src/libvterm/src/vterm.c src/version.c
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
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);
 }
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    788,
+/**/
     787,
 /**/
     786,