From 530bb2bf3b2972a960cbf4ed7ddd0cf4561b5f83 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Wed, 8 Jun 2016 21:36:37 -0700 Subject: [PATCH] 2016-06-09 Paul Pluzhnikov * test-skeleton.c (oom_error, xmalloc, xcalloc, xrealloc): New functions. (add_temp_file): Use them. --- ChangeLog | 6 +++++ test-skeleton.c | 58 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c07772eebe..58b05e8a48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-06-09 Paul Pluzhnikov + + * test-skeleton.c (oom_error, xmalloc, xcalloc, xrealloc): + New functions. + (add_temp_file): Use them. + 2016-06-09 Samuel Thibault name = newname; if (temp_name_list == NULL) @@ -124,13 +169,8 @@ create_temp_file (const char *base, char **filename) char *fname; int fd; - fname = (char *) malloc (strlen (test_dir) + 1 + strlen (base) - + sizeof ("XXXXXX")); - if (fname == NULL) - { - puts ("out of memory"); - return -1; - } + fname = (char *) xmalloc (strlen (test_dir) + 1 + strlen (base) + + sizeof ("XXXXXX")); strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX"); fd = mkstemp (fname);