summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/ld/rtld/malloc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gnu/usr.bin/ld/rtld/malloc.c b/gnu/usr.bin/ld/rtld/malloc.c
index 3ad09c1f245..af8fc1b7630 100644
--- a/gnu/usr.bin/ld/rtld/malloc.c
+++ b/gnu/usr.bin/ld/rtld/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.9 2003/06/02 19:55:59 millert Exp $ */
+/* $OpenBSD: malloc.c,v 1.10 2008/09/03 21:29:30 miod Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -31,7 +31,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";*/
-static char *rcsid = "$OpenBSD: malloc.c,v 1.9 2003/06/02 19:55:59 millert Exp $";
+static char *rcsid = "$OpenBSD: malloc.c,v 1.10 2008/09/03 21:29:30 miod Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -471,3 +471,18 @@ morepages(int n)
#endif
return n;
}
+
+void *
+calloc(size_t num, size_t size)
+{
+ void *p;
+
+ if (num && SIZE_MAX / num < size) {
+ return NULL;
+ }
+ size *= num;
+ p = malloc(size);
+ if (p)
+ memset(p, 0, size);
+ return(p);
+}