libctf: fix dict leak on archive-wide symbol lookup error path

If a lookup fails for a reason unrelated to a lack of type data for this
symbol, we return with an error; but we fail to close the dict we opened
most recently, which is leaked.

libctf/
	* ctf-archive.c (ctf_arc_lookup_sym_or_name): Close dict.
This commit is contained in:
Nick Alcock
2024-06-12 12:28:45 +01:00
parent 327356780a
commit e3cd566075

View File

@@ -957,6 +957,7 @@ ctf_arc_lookup_sym_or_name (ctf_archive_t *wrapper, unsigned long symidx,
{ {
if (errp) if (errp)
*errp = ctf_errno (fp); *errp = ctf_errno (fp);
ctf_dict_close (fp);
ctf_next_destroy (i); ctf_next_destroy (i);
return NULL; /* errno is set for us. */ return NULL; /* errno is set for us. */
} }