Problem: Memory leak in f_getreginfo() on alloc failure
Solution: Call list_unref() with list var (Yasuhiro Matsumoto).
Since dict_add_list() leaves ownership with the caller on failure, the
freshly built list must be freed when the add fails.
related: #20668
related: #20745
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
list = (list_T *)get_reg_contents(regname, GREG_EXPR_SRC | GREG_LIST);
if (list == NULL)
return;
- (void)dict_add_list(dict, "regcontents", list);
+ if (dict_add_list(dict, "regcontents", list) == FAIL)
+ list_unref(list);
switch (get_reg_type(regname, ®len))
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 801,
/**/
800,
/**/