Home GnuPG

core: New function gpgrt_reallocarray.

Description

core: New function gpgrt_reallocarray.

* src/init.c (_gpgrt_reallocarray): New.
* src/visibility.c (gpgrt_reallocarray): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add new function.
* src/gpg-error.h.in: Add new interface.
* tests/t-malloc.c: New.
* tests/Makefile.am (TESTS): Add new test.

Note that this function is different from the glibc function because
it has an extra parameter which allows to clear the new elements. A
realloc after a calloc with forgotten memset after it is a common
source of error, thus we introduce this slightly different function.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Mar 3 2020, 3:41 PM
Parents
rE72a15bad8f27: core: Fix allocation bug introduced with last commit.
Branches
Unknown
Tags
Unknown