util/parse-configs: Fix a resource leak in search_section_kv()
Vishal Verma
maintainerPATCH 1/1 util/parse-configs: Fix a resource leak in search_section_kv()
Static analysis points out that the memory pointed to by 'cur_sec' may be leaked. Fix the missed goto error; vs return NULL; exit path for an error condition here.
Cc Dan Williams <[email protected]>
Signed-off-by Vishal Verma <[email protected]>
--- util/parse-configs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/parse-configs.c +1 -1
@@ -57,7 +57,7 @@ static const char *search_section_kv(dictionary *d, const struct config *c)return NULL ;if (!c->section || !c->search_key || !c->search_val || !c->get_key) {fprintf (stderr,"warning: malformed config query, skipping\n" ); -return NULL ; + goto out_sec; } cur =strtok_r (cur_sec, delim, &save);
base-commit: c55b18181281b2fffadb9e0e8955d74b8b719349
Signature · 1 line
2.33.1
Quoted 7 lines · Vishal Verma
Static analysis points out that the memory pointed to by '
cur_sec' may be leaked. Fix the missed goto error; vs return NULL; exit path for an error condition here.Cc Dan Williams <[email protected]>Signed-off-by Vishal Verma <[email protected]>
Static analysis scores a point.
Reviewed-by Dan Williams <[email protected]>