diff options
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ChangeLog | 5 | ||||
-rw-r--r-- | libctf/ctf-link.c | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 0a8da12..7fdb355 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,10 @@ 2020-11-20 Nick Alcock <nick.alcock@oracle.com> + * ctf-link.c (ctf_link_deduplicating): Clean up the ctf_link_outputs + hash on error. + +2020-11-20 Nick Alcock <nick.alcock@oracle.com> + * ctf-create.c (ctf_dtd_insert): Set ENOMEM on the dict if out of memory. (ctf_dvd_insert): Likewise. (ctf_add_function): Report ECTF_RDONLY if this dict is not writable. diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 4b86ca9..cdf3db3 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1616,18 +1616,14 @@ ctf_link_deduplicating (ctf_dict_t *fp) { ctf_err_warn (fp, 0, 0, _("deduplicating link variable emission failed for " "%s"), ctf_link_input_name (fp)); - for (i = 1; i < noutputs; i++) - ctf_dict_close (outputs[i]); - goto err; + goto err_clean_outputs; } if (ctf_link_deduplicating_syms (fp, inputs, ninputs, 0) < 0) { ctf_err_warn (fp, 0, 0, _("deduplicating link symbol emission failed for " "%s"), ctf_link_input_name (fp)); - for (i = 1; i < noutputs; i++) - ctf_dict_close (outputs[i]); - goto err; + goto err_clean_outputs; } /* Now close all the inputs, including per-CU intermediates. */ @@ -1647,6 +1643,14 @@ ctf_link_deduplicating (ctf_dict_t *fp) free (parents); free (outputs); return; + + err_clean_outputs: + for (i = 1; i < noutputs; i++) + { + ctf_dynhash_remove (fp->ctf_link_outputs, ctf_cuname (outputs[i])); + ctf_dict_close (outputs[i]); + } + goto err; } /* Merge types and variable sections in all files added to the link |