sal/osl/unx/file.cxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 503195ad4df320da568fe089b4d0de2f761be660
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Sat Nov 5 18:50:15 2022 +0000
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 7 09:11:30 2022 +0100

    file: Use calloc
    
    Current code does, malloc->memset,  that's what calloc is for.
    
    Change-Id: Ie3a4872249f78442b96f98c9dad9d7170afe784c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142345
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index ac93ffacd13f..a39365b9b115 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -202,9 +202,7 @@ FileHandle_Impl::FileHandle_Impl(int fd, enum Kind kind, 
OString path)
         if (pagesize != size_t(-1))
         {
             m_bufsiz = pagesize;
-            m_buffer = static_cast<sal_uInt8 *>(malloc(m_bufsiz));
-            if (m_buffer)
-                memset(m_buffer, 0, m_bufsiz);
+            m_buffer = static_cast<sal_uInt8 *>(calloc(1, m_bufsiz));
         }
     }
 }

Reply via email to