Imported Upstream version 3.3.0
[platform/upstream/libarchive.git] / libarchive / test / test_archive_string.c
index 9e3f907..7fa743b 100644 (file)
@@ -67,6 +67,8 @@ test_archive_string_ensure(void)
 
        assert(&s == archive_string_ensure(&s, EXTENT + 1));
        assertNonNULLString(0, 2 * EXTENT, s);
+
+       archive_string_free(&s);
 }
 
 static void
@@ -92,6 +94,8 @@ test_archive_strcat(void)
        /* non-empty target, non-empty source */
        assert(&s == archive_strcat(&s, "baz"));
        assertExactString(8, EXTENT, "fubarbaz", s);
+
+       archive_string_free(&s);
 }
 
 static void
@@ -109,6 +113,8 @@ test_archive_strappend_char(void)
        /* non-empty target */
        archive_strappend_char(&s, 'Y');
        assertExactString(2, EXTENT, "XY", s);
+
+       archive_string_free(&s);
 }
 
 /* archive_strnXXX() tests focus on length handling.
@@ -134,6 +140,8 @@ test_archive_strncat(void)
        /* long read is ok too! */
        assert(&s == archive_strncat(&s, "snafu", 8));
        assertExactString(13, EXTENT, "snafubarsnafu", s);
+
+       archive_string_free(&s);
 }
 
 static void
@@ -155,6 +163,8 @@ test_archive_strncpy(void)
        /* long read is ok too! */
        assert(&s == archive_strncpy(&s, "snafu", 8));
        assertExactString(5, EXTENT, "snafu", s);
+
+       archive_string_free(&s);
 }
 
 static void
@@ -176,6 +186,8 @@ test_archive_strcpy(void)
        /* dirty target, empty source */
        assert(&s == archive_strcpy(&s, ""));
        assertExactString(0, EXTENT, "", s);
+
+       archive_string_free(&s);
 }
 
 static void
@@ -222,6 +234,11 @@ test_archive_string_concat(void)
        archive_string_concat(&t, &s);
        assertExactString(5, EXTENT, "snafu", s);
        assertExactString(5, EXTENT, "snafu", t);
+
+       archive_string_free(&v);
+       archive_string_free(&u);
+       archive_string_free(&t);
+       archive_string_free(&s);
 }
 
 static void
@@ -274,6 +291,11 @@ test_archive_string_copy(void)
        archive_string_copy(&t, &s);
        assertExactString(5, EXTENT, "fubar", s);
        assertExactString(5, EXTENT, "fubar", t);
+
+       archive_string_free(&v);
+       archive_string_free(&u);
+       archive_string_free(&t);
+       archive_string_free(&s);
 }
 
 static void
@@ -328,6 +350,8 @@ test_archive_string_sprintf(void)
        archive_string_empty(&s);
        archive_string_sprintf(&s, "%d", 1234567890);
        assertExactString(10, 8 * EXTENT, "1234567890", s);
+
+       archive_string_free(&s);
 }
 
 DEFINE_TEST(test_archive_string)