diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/tst-exec.c | 4 | ||||
-rw-r--r-- | posix/tst-pathconf.c | 9 | ||||
-rw-r--r-- | posix/tst-spawn.c | 6 | ||||
-rw-r--r-- | posix/tst-truncate.c | 2 |
4 files changed, 8 insertions, 13 deletions
diff --git a/posix/tst-exec.c b/posix/tst-exec.c index b0b04b5b9a..ef1638a45b 100644 --- a/posix/tst-exec.c +++ b/posix/tst-exec.c @@ -59,12 +59,12 @@ do_prepare (int argc, char *argv[]) size_t name_len; name_len = strlen (test_dir); - name1 = malloc (name_len + sizeof ("/execXXXXXX")); + name1 = xmalloc (name_len + sizeof ("/execXXXXXX")); mempcpy (mempcpy (name1, test_dir, name_len), "/execXXXXXX", sizeof ("/execXXXXXX")); add_temp_file (name1); - name2 = malloc (name_len + sizeof ("/execXXXXXX")); + name2 = xmalloc (name_len + sizeof ("/execXXXXXX")); mempcpy (mempcpy (name2, test_dir, name_len), "/execXXXXXX", sizeof ("/execXXXXXX")); add_temp_file (name2); diff --git a/posix/tst-pathconf.c b/posix/tst-pathconf.c index 949fc65428..4f51ae8c2d 100644 --- a/posix/tst-pathconf.c +++ b/posix/tst-pathconf.c @@ -41,12 +41,7 @@ prepare (void) static const char dir_name[] = "/tst-pathconf.XXXXXX"; size_t dirbuflen = test_dir_len + sizeof (dir_name); - dirbuf = malloc (dirbuflen); - if (dirbuf == NULL) - { - puts ("Out of memory"); - exit (1); - } + dirbuf = xmalloc (dirbuflen); snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name); if (mkdtemp (dirbuf) == NULL) @@ -73,7 +68,7 @@ do_test (void) static const char *fifo_name = "some-fifo"; size_t filenamelen = strlen (dirbuf) + strlen (fifo_name) + 2; - char *filename = malloc (filenamelen); + char *filename = xmalloc (filenamelen); snprintf (filename, filenamelen, "%s/%s", dirbuf, fifo_name); diff --git a/posix/tst-spawn.c b/posix/tst-spawn.c index c04609864e..6c8d7188a0 100644 --- a/posix/tst-spawn.c +++ b/posix/tst-spawn.c @@ -63,17 +63,17 @@ do_prepare (int argc, char *argv[]) size_t name_len; name_len = strlen (test_dir); - name1 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); + name1 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX")); mempcpy (mempcpy (name1, test_dir, name_len), "/spawnXXXXXX", sizeof ("/spawnXXXXXX")); add_temp_file (name1); - name2 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); + name2 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX")); mempcpy (mempcpy (name2, test_dir, name_len), "/spawnXXXXXX", sizeof ("/spawnXXXXXX")); add_temp_file (name2); - name3 = (char *) malloc (name_len + sizeof ("/spawnXXXXXX")); + name3 = (char *) xmalloc (name_len + sizeof ("/spawnXXXXXX")); mempcpy (mempcpy (name3, test_dir, name_len), "/spawnXXXXXX", sizeof ("/spawnXXXXXX")); add_temp_file (name3); diff --git a/posix/tst-truncate.c b/posix/tst-truncate.c index 8f5957f417..99bddb335f 100644 --- a/posix/tst-truncate.c +++ b/posix/tst-truncate.c @@ -59,7 +59,7 @@ do_prepare (int argc, char *argv[]) #define FNAME2(s) "/" STRINGIFY(s) "XXXXXX" name_len = strlen (test_dir); - name = malloc (name_len + sizeof (FNAME)); + name = xmalloc (name_len + sizeof (FNAME)); mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME)); add_temp_file (name); |