https://issues.apache.org/ooo/show_bug.cgi?id=120105
--- Comment #1 from ChaoHuang <[email protected]> --- The function "ScTableSheetObj::PrintAreaUndo_Impl" is called by these fuctions: 1)ScTableSheetObj::setPrintAreas 2)ScTableSheetObj::setPrintTitleColumns 3)ScTableSheetObj::setTitleColumns 4)ScTableSheetObj::setPrintTitleRows 5)ScTableSheetObj::setTitleRows The argument passed to function "ScTableSheetObj::PrintAreaUndo_Impl" is the same in these five functions. Here is the code snippet. ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); A new obj will be created on heap in function "ScDocument::CreatePrintRangeSaver". But there is no code to release pOldRanges in these five functions. In the body of function "ScTableSheetObj::PrintAreaUndo_Impl", there are two places to free obj "pOldRanges". 1) the "else" branch of "if ( pDocSh )" >>> to call "delete pOldRanges" directly 2) the branch of "if ( pDocSh ) && if (bUndo)" >>> to save it in the member data in class ScUndoPrintRange, to free it in the destructor of class ScUndoPrintRange. So there will be a memory leak about obj "pOldRanges" in the "else" branch of "if (bUndo)". The situation is the same for obj "pNewRanges" in function "ScTableSheetObj::PrintAreaUndo_Impl". The sulution is to free them explicitly. -- You are receiving this mail because: You are the assignee for the bug.
