summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index c3cea7c..7b18541 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,19 +25,16 @@
int
main(int argc, char *argv[])
{
- struct opkg_opk_ustar_seek_name *control_files_head;
- struct opkg_opk_ustar_seek_name *control_files_tail;
+ struct opkg_opk_ustar_seek_name *control_files;
struct opkg_opk_opk *opk;
- control_files_head = control_files_tail = NULL;
- if (opkg_opk_ustar_add_seek_name(
- &control_files_head, &control_files_tail,
- "control") != OPKG_OPK_OK) {
+ control_files = NULL;
+ if (opkg_opk_ustar_add_seek_name(&control_files, "control") !=
+ OPKG_OPK_OK) {
goto error0;
}
- if (opkg_opk_ustar_add_seek_name(
- &control_files_head, &control_files_tail,
- "md5sums") != OPKG_OPK_OK) {
+ if (opkg_opk_ustar_add_seek_name(&control_files, "md5sums") !=
+ OPKG_OPK_OK) {
goto error0;
}
@@ -51,7 +48,7 @@ main(int argc, char *argv[])
if (opkg_opk_opk_init_inner(opk, "control.tar.gz") != OPKG_OPK_OK) {
goto error1;
}
- if (opkg_opk_opk_read_control(opk, control_files_head) != OPKG_OPK_OK) {
+ if (opkg_opk_opk_read_control(opk, control_files) != OPKG_OPK_OK) {
goto error2;
}
opkg_opk_opk_free_inner(opk);
@@ -66,6 +63,7 @@ main(int argc, char *argv[])
opkg_opk_opk_free_inner(opk);
opkg_opk_opk_free_outer(opk);
+ opkg_opk_ustar_free_seek_names(control_files);
return EXIT_SUCCESS;
error2:
@@ -73,10 +71,6 @@ main(int argc, char *argv[])
error1:
opkg_opk_opk_free_outer(opk);
error0:
- while (control_files_head != NULL) {
- control_files_tail = control_files_head;
- control_files_head = control_files_head->next;
- free(control_files_tail);
- }
+ opkg_opk_ustar_free_seek_names(control_files);
return EXIT_FAILURE;
}