summaryrefslogtreecommitdiff
path: root/libarchive/test/test_write_format_iso9660_zisofs.c
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-11-14 16:10:40 +0900
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-11-14 16:10:40 +0900
commita875bd416968c4418ddc7f5dd25618e80817188d (patch)
tree078c7f2e660bf523b5300c8403c942df319f4860 /libarchive/test/test_write_format_iso9660_zisofs.c
parent59233211bf29c43d88f323e7d9403c2dc914ddb2 (diff)
downloadlibarchive-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.c9
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"));