diff options
-rw-r--r-- | src/opk.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -71,21 +71,21 @@ opkg_opk_opk_init_outer(const char *file_name) if (opk->file == NULL) { fprintf(stderr, "Error: Failed to open file \"%s\"\n", file_name); - goto error0; + goto error1; } /* Initialize outer gzip decompressor. */ opk->outer_gzip = opkg_opk_gzip_init(&_opkg_opk_opk_file_read, opk); if (opk->outer_gzip == NULL) { fputs("Error: Failed to initialize\n", stderr); - goto error1; + goto error2; } /* Initialize outer ustar unarchiver. */ opk->outer_ustar = opkg_opk_ustar_init(opk->outer_gzip); if (opk->outer_ustar == NULL) { fputs("Error: Failed to initialize\n", stderr); - goto error2; + goto error3; } /* Check package version. */ @@ -93,31 +93,33 @@ opkg_opk_opk_init_outer(const char *file_name) OPKG_OPK_OK) { fputs("Error: Failed to find \"debian-binary\" in archive\n", stderr); - goto error3; + goto error4; } if (opkg_opk_ustar_read(opk->outer_ustar, &opk->version_buffer, &opk->version_size) != OPKG_OPK_OK) { fputs("Error: Failed to read \"debian-binary\" in archive\n", stderr); - goto error3; + goto error4; } if (opk->version_size < 4 || strncmp(opk->version_buffer, "2.", 2) != 0) { fputs("Error: Unsupported package version\n", stderr); - goto error3; + goto error4; } opk->previously_printed = 0; return opk; - error3: + error4: opkg_opk_ustar_free(opk->outer_ustar); - error2: + error3: opkg_opk_gzip_free(opk->outer_gzip); - error1: + error2: fclose(opk->file); + error1: + free(opk); error0: return NULL; } |