cid#1602443: use_after_free
Change-Id: Ic7525bbd2d4d26f6bf07ecfb6ba6cf056a98580a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168339
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index fe1c917..91c4c5a 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -719,11 +719,11 @@ void SwRedlineTable::DeleteAndDestroyAll()
void SwRedlineTable::DeleteAndDestroy(size_type const nP)
{
auto const pRedline = maVector[nP];
if (pRedline == mpMaxEndPos)
mpMaxEndPos = nullptr;
maVector.erase(maVector.begin() + nP);
LOKRedlineNotification(RedlineNotification::Remove, pRedline);
delete pRedline;
if (pRedline == mpMaxEndPos)
mpMaxEndPos = nullptr;
}
SwRedlineTable::size_type SwRedlineTable::FindNextOfSeqNo( size_type nSttPos ) const