summary refs log tree commit diff
path: root/xmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 2db79ab..9cf824a 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -61,6 +61,18 @@ xcalloc(size_t no, size_t siz)
 	return(p);
 }
 
+void *
+xreallocarray(void *ptr, size_t nmemb, size_t size)
+{
+	void	*p;
+
+	p = reallocarray(ptr, nmemb, size);
+	if (p == NULL)
+		errx(1, "xreallocarray: out of memory (new_size %zu bytes)",
+		    nmemb * size);
+	return(p);
+}
+
 char *
 xstrdup(const char *str)
 {