changeset 17895:d55356da47c1 v8.1.1944

patch 8.1.1944: leaking memory when using sound callback Commit: https://github.com/vim/vim/commit/821d771e86dcfc64491b2619f799ac977fc32630 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 30 16:30:00 2019 +0200 patch 8.1.1944: leaking memory when using sound callback Problem: Leaking memory when using sound callback. Solution: src/sound.c
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Aug 2019 16:45:03 +0200
parents ae53536e31f0
children 6807cb2ca23c
files src/sound.c src/version.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/sound.c
+++ b/src/sound.c
@@ -171,6 +171,7 @@ invoke_sound_callback(void)
 	clear_tv(&rettv);
 
 	delete_sound_callback(scb->scb_callback);
+	vim_free(scb);
     }
     redraw_after_callback(TRUE);
 }
@@ -263,10 +264,21 @@ f_sound_clear(typval_T *argvars UNUSED, 
     void
 sound_free(void)
 {
+    soundcb_queue_T *scb;
+
     if (context != NULL)
 	ca_context_destroy(context);
+
     while (first_callback != NULL)
 	delete_sound_callback(first_callback);
+
+    while (callback_queue != NULL)
+    {
+	scb = callback_queue;
+	callback_queue = scb->scb_next;
+	delete_sound_callback(scb->scb_callback);
+	vim_free(scb);
+    }
 }
 # endif
 
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1944,
+/**/
     1943,
 /**/
     1942,