Mercurial > gnulib
diff lib/clean-temp.c @ 7603:23f14c284219
Simplify xmalloc expressions. Add overflow check in xmalloc arguments.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 06 Nov 2006 13:03:10 +0000 |
parents | 4a8b5467d8b2 |
children | cb2590895141 |
line wrap: on
line diff
--- a/lib/clean-temp.c Mon Nov 06 12:55:16 2006 +0000 +++ b/lib/clean-temp.c Mon Nov 06 13:03:10 2006 +0000 @@ -273,8 +273,7 @@ size_t old_allocated = cleanup_list.tempdir_allocated; size_t new_allocated = 2 * cleanup_list.tempdir_allocated + 1; struct tempdir * volatile *new_array = - (struct tempdir * volatile *) - xmalloc (new_allocated * sizeof (struct tempdir * volatile)); + XNMALLOC (new_allocated, struct tempdir * volatile); if (old_allocated == 0) /* First use of this facility. Register the cleanup handler. */ @@ -306,7 +305,7 @@ } /* Initialize a 'struct tempdir'. */ - tmpdir = (struct tempdir *) xmalloc (sizeof (struct tempdir)); + tmpdir = XMALLOC (struct tempdir); tmpdir->dirname = NULL; tmpdir->cleanup_verbose = cleanup_verbose; tmpdir->subdirs = gl_list_create_empty (GL_LINKEDHASH_LIST,