diff options
Diffstat (limited to 'libctf/ctf-dump.c')
-rw-r--r-- | libctf/ctf-dump.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index bd9b50d9479..b6af0dfe419 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -564,7 +564,6 @@ ctf_dump_type (ctf_id_t id, int flag, void *arg) { char *str; char *indent; - int err = 0; ctf_dump_state_t *state = arg; ctf_dump_membstate_t membstate = { &str, state->cds_fp, NULL }; @@ -619,9 +618,8 @@ ctf_dump_type (ctf_id_t id, int flag, void *arg) if (asprintf (&bit, "%s: %i\n", enumerand, value) < 0) { - err = ENOMEM; ctf_next_destroy (it); - goto err; + goto oom; } str = str_append (str, bit); free (bit); @@ -648,7 +646,15 @@ ctf_dump_type (ctf_id_t id, int flag, void *arg) err: free (indent); free (str); - return ctf_set_errno (state->cds_fp, err); + + /* Swallow the error: don't cause an error in one type to abort all + type dumping. */ + return 0; + + oom: + free (indent); + free (str); + return ctf_set_errno (state->cds_fp, ENOMEM); } /* Dump the string table into the cds_items. */ |