Kaydet (Commit) 7931ef2a authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Julien Nabet

connectivity: Fix memory leak at finding non-empty file

Change-Id: I7134dc4efb9a659727474a788dce19fcb8ea2da7
Reviewed-on: https://gerrit.libreoffice.org/39338Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 89494fc5
......@@ -55,6 +55,7 @@
#include <algorithm>
#include <cassert>
#include <memory>
using namespace ::comphelper;
using namespace connectivity;
......@@ -1057,13 +1058,10 @@ bool ODbaseTable::CreateImpl()
if (aContent.isDocument())
{
// Only if the file exists with length > 0 raise an error
SvStream* pFileStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ);
std::unique_ptr<SvStream> pFileStream(createStream_simpleError( aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::READ));
if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END))
{
return false;
}
delete pFileStream;
}
}
catch(const Exception&) // an exception is thrown when no file exists
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment