Reported by <deltatau@protonmail.com> via Assaf Gordon.
* tests/test-astrxfrm.c (main): Free allocated memory.
* tests/test-bitset.c (compare, check_attributes): Free allocated
bitsets.
* tests/test-filenamecat.c (main): Free allocated memory.
* tests/test-freadahead.c (main): Free allocated memory and close stdin.
* tests/test-freadptr.c (main): Likewise.
* tests/test-freadptr2.c (main): Free allocated memory.
* tests/test-freadseek.c (main): Likewise.
* tests/test-gc-arcfour.c (main): Close allocated context.
* tests/test-gc-arctwo.c (main): Likewise.
* tests/test-gc-des.c (main): Close all allocated contexts.
* tests/test-pipe-filter-gi1.c (main): Free allocated memory.
* tests/test-pipe-filter-ii1.c (main): Likewise.
* tests/test-posix_spawn_file_actions_addchdir.c (main): Destroy the
allocated file actions.
* tests/test-posix_spawn_file_actions_addclose.c (main): Likewise.
* tests/test-posix_spawn_file_actions_adddup2.c (main): Likewise.
* tests/test-posix_spawn_file_actions_addopen.c (main): Likewise.
* tests/test-sameacls.c (main): Free allocated memory and ACLs.
* tests/test-strfmon_l.c (main): Free allocated locales.
* tests/test-striconveh.c (main): Free allocated iconv_t objects.
* tests/uniconv/test-u8-conv-to-enc.c (main): Free allocated memory.
* tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
* tests/unistr/test-chr.h (main): Free input32.
* tests/unistr/test-strchr.h (test_strchr): Likewise.
+2019-03-10 Bruno Haible <bruno@clisp.org>
+
+ tests: Free allocated memory.
+ Reported by <deltatau@protonmail.com> via Assaf Gordon.
+ * tests/test-astrxfrm.c (main): Free allocated memory.
+ * tests/test-bitset.c (compare, check_attributes): Free allocated
+ bitsets.
+ * tests/test-filenamecat.c (main): Free allocated memory.
+ * tests/test-freadahead.c (main): Free allocated memory and close stdin.
+ * tests/test-freadptr.c (main): Likewise.
+ * tests/test-freadptr2.c (main): Free allocated memory.
+ * tests/test-freadseek.c (main): Likewise.
+ * tests/test-gc-arcfour.c (main): Close allocated context.
+ * tests/test-gc-arctwo.c (main): Likewise.
+ * tests/test-gc-des.c (main): Close all allocated contexts.
+ * tests/test-pipe-filter-gi1.c (main): Free allocated memory.
+ * tests/test-pipe-filter-ii1.c (main): Likewise.
+ * tests/test-posix_spawn_file_actions_addchdir.c (main): Destroy the
+ allocated file actions.
+ * tests/test-posix_spawn_file_actions_addclose.c (main): Likewise.
+ * tests/test-posix_spawn_file_actions_adddup2.c (main): Likewise.
+ * tests/test-posix_spawn_file_actions_addopen.c (main): Likewise.
+ * tests/test-sameacls.c (main): Free allocated memory and ACLs.
+ * tests/test-strfmon_l.c (main): Free allocated locales.
+ * tests/test-striconveh.c (main): Free allocated iconv_t objects.
+ * tests/uniconv/test-u8-conv-to-enc.c (main): Free allocated memory.
+ * tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
+ * tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
+ * tests/unistr/test-chr.h (main): Free input32.
+ * tests/unistr/test-strchr.h (test_strchr): Likewise.
+
2019-03-10 Bruno Haible <bruno@clisp.org>
tests: Prepare for using valgrind.
ASSERT (transform != NULL);
ASSERT (strcmp (transform, expected_transform) == 0);
ASSERT (length == strlen (transform) + 1);
+ free (transform);
}
/* Test resultbuf != NULL with an initial length = 0. */
ASSERT (strcmp (transform, expected_transform) == 0);
ASSERT (length == strlen (transform) + 1);
ASSERT (buf[0] == '@');
+ free (transform);
}
/* Test resultbuf != NULL with an initial length that is too small. */
ASSERT (strcmp (transform, expected_transform) == 0);
ASSERT (length == strlen (transform) + 1);
ASSERT (buf[sizeof (buf) - 1] == '@');
+ free (transform);
}
/* Test resultbuf != NULL with an initial length that is large enough. */
ASSERT (buf[sizeof (buf) - 1] == '@');
}
+ free (expected_transform);
+
return 0;
}
ASSERT (bitset_or_and_cmp (adst, asrc0, asrc1, asrc2)
== bitset_or_and_cmp (bdst, bsrc0, bsrc1, bsrc2));
assert_bitset_equal (adst, bdst);
+
+ bitset_free (bdst);
+ bitset_free (bsrc3);
+ bitset_free (bsrc2);
+ bitset_free (bsrc1);
+ bitset_free (bsrc0);
+ bitset_free (adst);
+ bitset_free (asrc3);
+ bitset_free (asrc2);
+ bitset_free (asrc1);
+ bitset_free (asrc0);
}
void check_attributes (enum bitset_attr attr)
/* or */
bitset_or (bs, bs1, bs2);
ASSERT (bitset_count (bs) == 6);
+
+ bitset_free (bs);
+ bitset_free (bs2);
+ bitset_free (bs1);
+ bitset_free (bs0);
}
int main (void)
i, t[0], res);
fail = true;
}
+ free (res);
}
exit (fail ? EXIT_FAILURE : EXIT_SUCCESS);
}
{
void *buf = malloc (nbytes);
ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+ free (buf);
}
if (nbytes == 0)
}
}
+ /* Free memory allocated during ungetc(). */
+ fclose (stdin);
+
return 0;
}
main (int argc, char **argv)
{
int nbytes = atoi (argv[1]);
- void *buf = malloc (nbytes);
- ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+ {
+ void *buf = malloc (nbytes);
+ ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+ free (buf);
+ }
if (lseek (0, 0, SEEK_CUR) == nbytes)
{
}
}
+ /* Free memory allocated during ungetc(). */
+ fclose (stdin);
+
return 0;
}
{
void *buf = malloc (nbytes);
ASSERT (fread (buf, 1, nbytes, stdin) == nbytes);
+ free (buf);
}
if (nbytes == 0)
ASSERT (!ferror (stdin));
#endif
+ free (buf7);
+ free (buf5);
+ free (buf3);
+ free (buf1);
+
return 0;
}
return 1;
}
+ gc_cipher_close (ctx);
+
gc_done ();
return 0;
return 1;
}
+ gc_cipher_close (ctx);
+
gc_done ();
return 0;
int
main (int argc, char *argv[])
{
- gc_cipher_handle ctx;
Gc_rc rc;
rc = gc_init ();
char input[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
char result[8] = { 0x24, 0x6e, 0x9d, 0xb9, 0xc5, 0x50, 0x38, 0x1a };
char temp1[8], temp2[8], temp3[8];
+ gc_cipher_handle ctx_array[64];
for (i = 0; i < 64; ++i)
{
+ gc_cipher_handle ctx;
rc = gc_cipher_open (GC_DES, GC_ECB, &ctx);
if (rc != GC_OK)
memcpy (key, temp3, 8);
memcpy (input, temp1, 8);
+
+ ctx_array[i] = ctx;
}
if (memcmp (temp3, result, 8))
return 1;
+
+ for (i = 0; i < 64; ++i)
+ gc_cipher_close (ctx_array[i]);
}
gc_done ();
ASSERT (l.nread == input_size);
}
+ free (input);
+
return 0;
}
ASSERT (l.nread == input_size);
}
+ free (input);
+
return 0;
}
ASSERT (posix_spawn_file_actions_addchdir (&actions, "/") == 0);
+ posix_spawn_file_actions_destroy (&actions);
+
return 0;
}
ASSERT (posix_spawn_file_actions_addclose (&actions, bad_fd) == EBADF);
}
+ posix_spawn_file_actions_destroy (&actions);
+
return 0;
}
ASSERT (posix_spawn_file_actions_adddup2 (&actions, 2, bad_fd) == EBADF);
}
+ posix_spawn_file_actions_destroy (&actions);
+
return 0;
}
== EBADF);
}
+ posix_spawn_file_actions_destroy (&actions);
+
return 0;
}
fflush (stderr);
abort ();
}
+
+ free (contents2);
+ free (contents1);
}
/* Compare the access permissions of the two files, including ACLs. */
return 1;
}
}
+ acl_free (text2);
+ if (acl2 != (acl_t)NULL)
+ acl_free (acl2);
+ acl_free (text1);
+ if (acl1 != (acl_t)NULL)
+ acl_free (acl1);
}
#elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
int count1;
return 1;
}
}
+ free (entries2);
+ free (entries1);
}
# ifdef ACE_GETACL
count1 = acl (file1, ACE_GETACLCNT, 0, NULL);
return 1;
}
}
+ free (entries2);
+ free (entries1);
}
# endif
#elif HAVE_GETACL /* HP-UX */
return 1;
}
}
+ free (entries2);
+ free (entries1);
}
# if HAVE_ACLV_H /* HP-UX >= 11.11 */
return 1;
}
}
+ free (entries2);
+ free (entries1);
}
# endif
#elif HAVE_ACLX_GET /* AIX */
return 1;
}
}
+ free (entries2);
+ free (entries1);
}
#endif
}
loc = newlocale (LC_ALL_MASK, "en_US.UTF-8", NULL);
ASSERT (strfmon_l (buf, sizeof (buf), loc, "%.2n", 123.5) >= 0);
ASSERT (strcmp (buf, expected_buf) == 0);
+ freelocale (loc);
}
{
char expected_buf[80];
loc = newlocale (LC_ALL_MASK, "de_DE.UTF-8", NULL);
ASSERT (strfmon_l (buf, sizeof (buf), loc, "%.2n", 123.5) >= 0);
ASSERT (strcmp (buf, expected_buf) == 0);
+ freelocale (loc);
}
#endif
#endif
+ /* -------------------------------- Done. -------------------------------- */
+
+ if (cd_ascii_to_88591 != (iconv_t)(-1))
+ iconv_close (cd_ascii_to_88591);
+ iconv_close (cd_ascii_to_utf8);
+ if (cd_utf7_to_utf8 != (iconv_t)(-1))
+ iconv_close (cd_utf7_to_utf8);
+
return 0;
}
ASSERT (result == NULL);
ASSERT (errno == EILSEQ);
ASSERT (length == 0xdead);
+ if (o)
+ free (offsets);
break;
case iconveh_question_mark:
{
ASSERT (result == NULL);
ASSERT (errno == EILSEQ);
ASSERT (length == 0xdead);
+ if (o)
+ free (offsets);
break;
case iconveh_question_mark:
{
ASSERT (result == NULL);
ASSERT (errno == EILSEQ);
ASSERT (length == 0xdead);
+ if (o)
+ free (offsets);
break;
case iconveh_question_mark:
{
}
free (input);
+ if (sizeof (UNIT) != sizeof (uint32_t))
+ free (input32);
return 0;
}
#endif
free (input);
+ if (sizeof (UNIT) != sizeof (uint32_t))
+ free (input32);
}