comparison src/change.c @ 18225:6c3a8312486d v8.1.2107

patch 8.1.2107: various memory leaks reported by asan Commit: https://github.com/vim/vim/commit/8617348e2110c2c8387ea448a6258f1effa8d249 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 1 17:02:16 2019 +0200 patch 8.1.2107: various memory leaks reported by asan Problem: Various memory leaks reported by asan. Solution: Free the memory. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/5003)
author Bram Moolenaar <Bram@vim.org>
date Tue, 01 Oct 2019 17:15:04 +0200
parents e0ec4cd7a865
children fe5afdc03bd2
comparison
equal deleted inserted replaced
18224:96632a3c3d90 18225:6c3a8312486d
298 listener_T *next; 298 listener_T *next;
299 listener_T *prev; 299 listener_T *prev;
300 int id = tv_get_number(argvars); 300 int id = tv_get_number(argvars);
301 buf_T *buf; 301 buf_T *buf;
302 302
303 for (buf = firstbuf; buf != NULL; buf = buf->b_next) 303 FOR_ALL_BUFFERS(buf)
304 { 304 {
305 prev = NULL; 305 prev = NULL;
306 for (lnr = buf->b_listener; lnr != NULL; lnr = next) 306 for (lnr = buf->b_listener; lnr != NULL; lnr = next)
307 { 307 {
308 next = lnr->lr_next; 308 next = lnr->lr_next;
399 if (save_updating_screen) 399 if (save_updating_screen)
400 updating_screen = TRUE; 400 updating_screen = TRUE;
401 else 401 else
402 after_updating_screen(TRUE); 402 after_updating_screen(TRUE);
403 recursive = FALSE; 403 recursive = FALSE;
404 }
405
406 /*
407 * Remove all listeners associated with "buf".
408 */
409 void
410 remove_listeners(buf_T *buf)
411 {
412 listener_T *lnr;
413 listener_T *next;
414
415 for (lnr = buf->b_listener; lnr != NULL; lnr = next)
416 {
417 next = lnr->lr_next;
418 free_callback(&lnr->lr_callback);
419 vim_free(lnr);
420 }
421 buf->b_listener = NULL;
404 } 422 }
405 #endif 423 #endif
406 424
407 /* 425 /*
408 * Common code for when a change was made. 426 * Common code for when a change was made.