diff options
author | Dr. David Alan Gilbert <dave@treblig.org> | 2022-11-05 18:33:07 +0000 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-07 09:09:14 +0100 |
commit | fa40ea19dbea5f0618d86da8626c35e734bb5220 (patch) | |
tree | c5fd68640375aef62b4179a3f679e0ada5b06cca /comphelper/source | |
parent | f18ef67d7ce02ead53a6dc3c2a985d8b51b7afda (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
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 |