[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Free unfreed string in assign_assoc_from_kvlist()
From: |
konsolebox |
Subject: |
[PATCH] Free unfreed string in assign_assoc_from_kvlist() |
Date: |
Mon, 19 Apr 2021 23:27:13 +0800 |
I looked at this code plenty of times and I really think the returned
value to expand_assignment_string_to_string (v, 0) needs to be freed
too when aval != 0.
diff --git a/arrayfunc.c b/arrayfunc.c
index 8231ba1e..48c43294 100644
--- a/arrayfunc.c
+++ b/arrayfunc.c
@@ -568,8 +568,6 @@ assign_assoc_from_kvlist (var, nlist, h, flags)
for (list = nlist; list; list = list->next)
{
- free_aval = 0;
-
k = list->word->word;
v = list->next ? list->next->word->word : 0;
@@ -589,12 +587,10 @@ assign_assoc_from_kvlist (var, nlist, h, flags)
{
aval = (char *)xmalloc (1);
aval[0] = '\0'; /* like do_assignment_internal */
- free_aval = 1;
}
bind_assoc_var_internal (var, h, akey, aval, flags);
- if (free_aval)
- free (aval);
+ free (aval);
}
}
--
konsolebox
- [PATCH] Free unfreed string in assign_assoc_from_kvlist(),
konsolebox <=