summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-12 15:40:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-16 08:22:38 +0200
commit23ae341869ddb0d1af81ee7a5705b776817afd4c (patch)
treebca4162c9614efc144191da0292fb5a20bec4af3 /tools
parent3d44b720f58366398e7f59c00dba6339712a670f (diff)
assert that we own the data before freeing it
Change-Id: I9676da22c00570cd59f2f46b04beb5f1337bbacf Reviewed-on: https://gerrit.libreoffice.org/52887 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/stream/stream.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 5d6d3e58336b..b48275819739 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1866,7 +1866,12 @@ bool SvMemoryStream::ReAllocateMemory( long nDiff )
void SvMemoryStream::FreeMemory()
{
- delete[] pBuf;
+ assert(bOwnsData);
+ if (bOwnsData)
+ {
+ delete[] pBuf;
+ pBuf = nullptr;
+ }
}
void* SvMemoryStream::SwitchBuffer()