aboutsummaryrefslogtreecommitdiffstats
path: root/xmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--xmalloc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 94f0691..21a65d7 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xmalloc.c,v 1.14 2015/01/19 14:54:16 okan Exp $
+ * $OpenBSD: xmalloc.c,v 1.15 2015/03/28 23:12:47 okan Exp $
*/
#include <sys/types.h>
@@ -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)
{