summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authordante <dante19031999@gmail.com>2022-05-11 13:19:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-05-13 11:28:33 +0200
commit27a273293618e6dbc2de5b299247b1d9f05864c6 (patch)
treecf2a950d1926ad27b7dadc0b604fcb6e870fff0b /sal
parent3817965ded6c7ed915e4f9599e18b3e8abdaca44 (diff)
Use calloc instead of malloc and memset
Change-Id: I591ee7f5360a30779f831f6492cdbe71ab94099e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/alloc_global.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 9ceba4f4120f..4b7ec6037dc1 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -53,10 +53,8 @@ void SAL_CALL rtl_freeMemory(void * p) SAL_THROW_EXTERN_C()
void * SAL_CALL rtl_allocateZeroMemory(sal_Size n) SAL_THROW_EXTERN_C()
{
- void * p = rtl_allocateMemory (n);
- if (p)
- memset (p, 0, n);
- return p;
+ SAL_WARN_IF( n >= SAL_MAX_INT32, "sal.rtl", "suspicious massive alloc " << n);
+ return calloc(n, 1);
}
void SAL_CALL rtl_freeZeroMemory(void * p, sal_Size n) SAL_THROW_EXTERN_C()