diff options
author | Werner Koch <[email protected]> | 2020-03-03 14:41:39 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-03-03 14:41:39 +0000 |
commit | 969abd302211262562df93ae5412ee319aae69e6 (patch) | |
tree | 37fc4be7deab2afa11c86faf76f324ad15c7302f /src/visibility.h | |
parent | core: Fix allocation bug introduced with last commit. (diff) | |
download | libgpg-error-969abd302211262562df93ae5412ee319aae69e6.tar.gz libgpg-error-969abd302211262562df93ae5412ee319aae69e6.zip |
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 <[email protected]>
Diffstat (limited to 'src/visibility.h')
-rw-r--r-- | src/visibility.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/visibility.h b/src/visibility.h index 0759d2f..f7d16be 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -152,6 +152,7 @@ MARK_VISIBLE (gpgrt_get_syscall_clamp) MARK_VISIBLE (gpgrt_set_alloc_func) MARK_VISIBLE (gpgrt_realloc) +MARK_VISIBLE (gpgrt_reallocarray) MARK_VISIBLE (gpgrt_malloc) MARK_VISIBLE (gpgrt_calloc) MARK_VISIBLE (gpgrt_strdup) @@ -333,6 +334,7 @@ MARK_VISIBLE (gpgrt_absfnameconcat); #define gpgrt_vsnprintf _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_realloc _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_reallocarray _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_malloc _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_calloc _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_strdup _gpgrt_USE_UNDERSCORED_FUNCTION |