mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 8.1.1944: leaking memory when using sound callback
Problem: Leaking memory when using sound callback. Solution: src/sound.c
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/sound.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/sound.c
									
									
									
									
									
								
							| @@ -171,6 +171,7 @@ invoke_sound_callback(void) | |||||||
| 	clear_tv(&rettv); | 	clear_tv(&rettv); | ||||||
|  |  | ||||||
| 	delete_sound_callback(scb->scb_callback); | 	delete_sound_callback(scb->scb_callback); | ||||||
|  | 	vim_free(scb); | ||||||
|     } |     } | ||||||
|     redraw_after_callback(TRUE); |     redraw_after_callback(TRUE); | ||||||
| } | } | ||||||
| @@ -263,10 +264,21 @@ f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED) | |||||||
|     void |     void | ||||||
| sound_free(void) | sound_free(void) | ||||||
| { | { | ||||||
|  |     soundcb_queue_T *scb; | ||||||
|  |  | ||||||
|     if (context != NULL) |     if (context != NULL) | ||||||
| 	ca_context_destroy(context); | 	ca_context_destroy(context); | ||||||
|  |  | ||||||
|     while (first_callback != NULL) |     while (first_callback != NULL) | ||||||
| 	delete_sound_callback(first_callback); | 	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 | # endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -761,6 +761,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     1944, | ||||||
| /**/ | /**/ | ||||||
|     1943, |     1943, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user