comparison src/dict.c @ 18201:2ec4ed3f5e12 v8.1.2095

patch 8.1.2095: leaking memory when getting item from dict Commit: https://github.com/vim/vim/commit/a893194d91a2942d4d54085d746ed137a9251b69 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 28 17:25:10 2019 +0200 patch 8.1.2095: leaking memory when getting item from dict Problem: Leaking memory when getting item from dict. Solution: Also free the key when not evaluating.
author Bram Moolenaar <Bram@vim.org>
date Sat, 28 Sep 2019 17:30:03 +0200
parents fb773f73a4be
children 3a68dc2a1bc1
comparison
equal deleted inserted replaced
18200:d953ad50f7e5 18201:2ec4ed3f5e12
820 clear_tv(&tvkey); 820 clear_tv(&tvkey);
821 clear_tv(&tv); 821 clear_tv(&tv);
822 goto failret; 822 goto failret;
823 } 823 }
824 item = dictitem_alloc(key); 824 item = dictitem_alloc(key);
825 clear_tv(&tvkey);
826 if (item != NULL) 825 if (item != NULL)
827 { 826 {
828 item->di_tv = tv; 827 item->di_tv = tv;
829 item->di_tv.v_lock = 0; 828 item->di_tv.v_lock = 0;
830 if (dict_add(d, item) == FAIL) 829 if (dict_add(d, item) == FAIL)
831 dictitem_free(item); 830 dictitem_free(item);
832 } 831 }
833 } 832 }
833 clear_tv(&tvkey);
834 834
835 if (**arg == '}') 835 if (**arg == '}')
836 break; 836 break;
837 if (**arg != ',') 837 if (**arg != ',')
838 { 838 {