unit-tests: Clean up memory in new asn1 unit tests
authorMartin Willi <martin@revosec.ch>
Mon, 4 Nov 2013 11:13:08 +0000 (12:13 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 6 Nov 2013 09:31:00 +0000 (10:31 +0100)
Test runner checks for leaks when leak detective is enabled.

src/libstrongswan/tests/suites/test_asn1.c

index 5ac4a94..1cd81e0 100644 (file)
@@ -45,6 +45,7 @@ START_TEST(test_asn1_algorithmIdentifier)
        {
                algid = asn1_algorithmIdentifier(test[i].n);
                ck_assert(chunk_equals(algid, test[i].algid));
+               free(algid.ptr);
        }
 }
 END_TEST
@@ -527,6 +528,7 @@ START_TEST(test_asn1_from_time)
         }
                chunk = asn1_from_time(&test[i].time, test[i].type);
                ck_assert(chunk_equals(chunk, test[i].chunk));
+               free(chunk.ptr);
        }
 }
 END_TEST
@@ -600,7 +602,7 @@ START_TEST(test_asn1_build_object)
                pos = asn1_build_object(&a, test[i].b[0], test[i].len);
                ck_assert(pos == (a.ptr + test[i].size));
                ck_assert(a.len == test[i].size + test[i].len);
-               ck_assert(memeq(a.ptr, test[i].b, test[i].size)); 
+               ck_assert(memeq(a.ptr, test[i].b, test[i].size));
                chunk_free(&a);
        }
 }