summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/reallocarray.c
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2015-02-17 20:29:20 +0000
committerjoerg <joerg@NetBSD.org>2015-02-17 20:29:20 +0000
commit47b295930081025995b75b5b3a148ceb3a93e8ef (patch)
treea03d2f6d59e190f49b3c64849d9cc39801d1ae5f /lib/libc/stdlib/reallocarray.c
parent68a97964b7cd37d797f6b85c70a06550155961c6 (diff)
Introduce reallocarr(3) for easy (re)allocation of memory with overflow
checks. Compared to OpenBSD's reallocarray, makes it easier to avoid memory leaks on allocation failures and it doesn't depend on malloc(0) != NULL for correct error checking. Compared to plain realloc, it also avoids the problem of intermediate integer overflows. The trade-off is the use of void * to side step C type system with regard to generic pointer to pointer.
Diffstat (limited to 'lib/libc/stdlib/reallocarray.c')
0 files changed, 0 insertions, 0 deletions