sal/rtl/alloc_global.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 27a273293618e6dbc2de5b299247b1d9f05864c6
Author:     dante <dante19031...@gmail.com>
AuthorDate: Wed May 11 13:19:43 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri May 13 11:28:33 2022 +0200

    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 <sberg...@redhat.com>

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()

Reply via email to