Apache OpenOffice (AOO) Bugzilla – Issue 120108
[From Symphony] There is a memory leak in function ScViewData::ReadUserDataSequence
Last modified: 2013-02-16 09:10:01 UTC
Steps to reproduce the defect: 1) Launch Aoo3.4 2) New a ods file 3) Close it Defect : There is a memory leak in function ScViewData::ReadUserDataSequence
In the first loop of function "ScViewData::ReadUserDataSequence", pTabData[nTab] will be reassigned to a new obj on heap. If the previous value is not NULL, there will be no place to release the previous obj. So it may be a memory leak. The solution is to check the pTabData[nTab] and free it if possible before reassignment.
Created attachment 78507 [details] for file "main/sc/source/ui/view/viewdata.cxx"
Comment on attachment 78507 [details] for file "main/sc/source/ui/view/viewdata.cxx" Thanks for finding the problem and the solution! Applied as revision 1354849 I apologize for slightly changing the fix because IMHO there is - no need to check for NULL before delete, especially for stuff that is more often than not non-NULL - the code comment did not make the code more clear and the details of the particular change belong into the revision history, but not into the code. If every change ever done in a file was commented like that it would become unreadable That's only my opinion of course. If you as the author of the fix disagrees with that I'll reapply it in the original style.
updated status to resolved as the fix has been applied.
(In reply to comment #3) > Comment on attachment 78507 [details] > for file "main/sc/source/ui/view/viewdata.cxx" > > Thanks for finding the problem and the solution! Applied as revision 1354849 > > I apologize for slightly changing the fix because IMHO there is > - no need to check for NULL before delete, especially for stuff that is more > often than not non-NULL Yes, "delete NULL" is safe, anyway > - the code comment did not make the code more clear and the details of the > particular change belong into the revision history, but not into the code. > If every change ever done in a file was commented like that it would become > unreadable Totally agreed with your suggestion. The description for changing is needed in comments. > > That's only my opinion of course. If you as the author of the fix disagrees > with that I'll reapply it in the original style. Thanks for your suggestion !
Since last SVT(r1400866) shows there is no memory leak, so close this defect as resolved.