sal/osl/unx/security.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 1bd83f0f6ad3d9fa84b4eae38b3393526e233771
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Sep 7 18:22:27 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Sep 7 21:39:41 2022 +0200

    Be careful with failed realloc
    
    Change-Id: I809e70487b9174ae902d3a11cc2845ec310d009f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139610
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index f541c90001b3..1b1f16a54edc 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -105,7 +105,9 @@ static oslSecurityImpl * growSecurityImpl(
             n = std::numeric_limits<std::size_t>::max();
         }
         p = static_cast<oslSecurityImpl *>(realloc(impl, n));
-        memset (p, 0, n);
+        if (p != nullptr) {
+            memset (p, 0, n);
+        }
     }
     if (p == nullptr) {
         free(impl);

Reply via email to