Kaydet (Commit) d4168250 authored tarafından Noel Grandin's avatar Noel Grandin

coverity#1437962 and 1437961 and 1437955 and 1437951 resource leak

regression from

    commit 0fb5ca6c
    tdf#79877 perf loading docx file, writerfilter/ improvements

Change-Id: I76792bd635eacc60647a097e070ce7b963fd122f
Reviewed-on: https://gerrit.libreoffice.org/57478
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a3b960fe
......@@ -114,7 +114,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
checkUnicode(/*bUnicode =*/nKeyword != RTF_U, /*bHex =*/true);
RTFSkipDestination aSkip(*this);
int nSprm = 0;
auto pIntValue = new RTFValue(nParam);
tools::SvRef<RTFValue> pIntValue(new RTFValue(nParam));
// Trivial table sprms.
switch (nKeyword)
{
......@@ -600,7 +600,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_SL:
{
// This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'.
auto pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast);
tools::SvRef<RTFValue> pValue(
new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_atLeast));
if (nParam < 0)
{
pValue = new RTFValue(NS_ooxml::LN_Value_doc_ST_LineSpacingRule_exact);
......@@ -905,7 +906,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
OUString hRule("auto");
if (nParam < 0)
{
auto pAbsValue = new RTFValue(-nParam);
tools::SvRef<RTFValue> pAbsValue(new RTFValue(-nParam));
std::swap(pIntValue, pAbsValue);
hRule = "exact";
......
......@@ -1064,10 +1064,10 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second);
}
}
auto pAnchorWrapValue = new RTFValue(aAnchorWrapAttributes);
aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
if (!aAnchorWrapAttributes.empty() && nWrap == -1)
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue);
aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare,
new RTFValue(aAnchorWrapAttributes));
// See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
RTFSprms aPoshAttributes;
......@@ -1512,9 +1512,8 @@ void RTFDocumentImpl::prepareProperties(
NS_ooxml::LN_CT_TblWidth_w, pWValue);
}
auto pRowValue = new RTFValue(1);
if (nCells > 0)
rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, pRowValue);
rState.aTableRowSprms.set(NS_ooxml::LN_tblRow, new RTFValue(1));
RTFValue::Pointer_t const pCellMar
= rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblCellMar);
......@@ -1700,7 +1699,7 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
checkUnicode(/*bUnicode =*/true, /*bHex =*/true);
RTFSkipDestination aSkip(*this);
int nSprm = -1;
auto pBoolValue = new RTFValue(int(!bParam || nParam != 0));
tools::SvRef<RTFValue> pBoolValue(new RTFValue(int(!bParam || nParam != 0)));
// Underline toggles.
switch (nKeyword)
......
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