aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libctf/ctf-archive.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c
index 451d6c6..f459c02 100644
--- a/libctf/ctf-archive.c
+++ b/libctf/ctf-archive.c
@@ -1063,7 +1063,7 @@ ctf_archive_iter (const ctf_archive_t *arc, ctf_archive_member_f *func,
ctf_next_t *i = NULL;
ctf_dict_t *fp;
const char *name;
- int err;
+ int err = 0;
while ((fp = ctf_archive_next (arc, &i, &name, 0, &err)) != NULL)
{
@@ -1077,6 +1077,11 @@ ctf_archive_iter (const ctf_archive_t *arc, ctf_archive_member_f *func,
}
ctf_dict_close (fp);
}
+ if (err != ECTF_NEXT_END && err != 0)
+ {
+ ctf_next_destroy (i);
+ return -1;
+ }
return 0;
}