comphelper/source/misc/backupfilehelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa40ea19dbea5f0618d86da8626c35e734bb5220
Author:     Dr. David Alan Gilbert <d...@treblig.org>
AuthorDate: Sat Nov 5 18:33:07 2022 +0000
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 7 09:09:14 2022 +0100

    TempFile: Initialise handle
    
    If the tempfile creation fails, the handle is left uninitialised
    but we still try and close it, and we explode with various
    pthread locking corruptions.
    
    I think this could be the cause of a bunch of the:
    https://crashreport.libreoffice.org/stats/signature/osl_closeFile
    
    I can trigger it on Linux by setting TMPDIR to a bogus value,
    but I don't think that's all the cases that we see in the crash reports.
    
    Initialising it to null makes the close take a safe path.
    
    Change-Id: If66c5629b6bce62e6c4b18a97ecb901abedd4ea3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142343
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/source/misc/backupfilehelper.cxx 
b/comphelper/source/misc/backupfilehelper.cxx
index d225b9f301d9..e9b173a47369 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -1244,7 +1244,7 @@ namespace
             {
                 // need to create a new pack file, do this in a temp file to 
which data
                 // will be copied from local file (so keep it here until this 
is done)
-                oslFileHandle aHandle;
+                oslFileHandle aHandle = nullptr;
                 OUString aTempURL;
 
                 // open target temp file - it exists until deleted

Reply via email to