diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-11-14 16:10:40 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-11-14 16:10:40 +0900 |
commit | a875bd416968c4418ddc7f5dd25618e80817188d (patch) | |
tree | 078c7f2e660bf523b5300c8403c942df319f4860 /libarchive/test/test_write_format_iso9660_zisofs.c | |
parent | 59233211bf29c43d88f323e7d9403c2dc914ddb2 (diff) | |
download | libarchive-a875bd416968c4418ddc7f5dd25618e80817188d.tar.gz |
Fix bugs in test programs which Clang Static Analyzer pointed out.
Diffstat (limited to 'libarchive/test/test_write_format_iso9660_zisofs.c')
-rw-r--r-- | libarchive/test/test_write_format_iso9660_zisofs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libarchive/test/test_write_format_iso9660_zisofs.c b/libarchive/test/test_write_format_iso9660_zisofs.c index 26a30586..136255b3 100644 --- a/libarchive/test/test_write_format_iso9660_zisofs.c +++ b/libarchive/test/test_write_format_iso9660_zisofs.c @@ -106,6 +106,8 @@ test_write_format_iso9660_zisofs_1(void) memset(nullb, 0, sizeof(nullb)); buff = malloc(buffsize); assert(buff != NULL); + if (buff == NULL) + return; /* ISO9660 format: Create a new archive in memory. */ assert((a = archive_write_new()) != NULL); @@ -115,6 +117,7 @@ test_write_format_iso9660_zisofs_1(void) if (r == ARCHIVE_FATAL) { skipping("zisofs option not supported on this platform"); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); return; } assertEqualIntA(a, 0, archive_write_set_option(a, NULL, "pad", NULL)); @@ -335,6 +338,8 @@ test_write_format_iso9660_zisofs_2(void) buff = malloc(buffsize); assert(buff != NULL); + if (buff == NULL) + return; /* ISO9660 format: Create a new archive in memory. */ assert((a = archive_write_new()) != NULL); @@ -344,6 +349,7 @@ test_write_format_iso9660_zisofs_2(void) if (r == ARCHIVE_FATAL) { skipping("zisofs option not supported on this platform"); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); return; } assertEqualIntA(a, 0, archive_write_set_option(a, NULL, "pad", NULL)); @@ -585,6 +591,8 @@ test_write_format_iso9660_zisofs_3(void) memset(nullb, 0, sizeof(nullb)); buff = malloc(buffsize); assert(buff != NULL); + if (buff == NULL) + return; /* ISO9660 format: Create a new archive in memory. */ assert((a = archive_write_new()) != NULL); @@ -594,6 +602,7 @@ test_write_format_iso9660_zisofs_3(void) if (r == ARCHIVE_FATAL) { skipping("zisofs option not supported on this platform"); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); return; } assertEqualIntA(a, 0, archive_write_set_option(a, NULL, "boot", "boot.img")); |