Review Request: khtml: Fix memleak in DOMStringImpl::lower usage

Bernd Buschinski b.buschinski at googlemail.com
Tue May 29 19:05:37 BST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105099/
-----------------------------------------------------------

Review request for kdelibs.


Description
-------

khtml: Fix memleak in DOMStringImpl::lower usage

DOMStringImpl::lower() returns a new lower DOMStringImp*, which needs to be freed.
While it does make sense for all other places, and in all other places we keep proper track of it, this is not the case in 
khtml::ProspectiveTokenizer::processAttribute() (htmlprospectivetokenizer.cpp:720)


This fixed memleaks like:

==17681== 728 (512 direct, 216 indirect) bytes in 16 blocks are definitely lost in loss record 2,907 of 3,059
==17681==    at 0x4C2ABE7: operator new(unsigned long) (vg_replace_malloc.c:287)
==17681==    by 0x1A7D38E9: DOM::DOMStringImpl::lower() const (dom_stringimpl.cpp:396)
==17681==    by 0x1A802734: khtml::ProspectiveTokenizer::processAttribute() (htmlprospectivetokenizer.cpp:720)
==17681==    by 0x1A803DEF: khtml::ProspectiveTokenizer::tokenize(khtml::TokenizerString const&) (htmlprospectivetokenizer.cpp:540)
==17681==    by 0x1A7FD0D7: khtml::HTMLTokenizer::scriptHandler() (htmltokenizer.cpp:497)
==17681==    by 0x1A7FD4DC: khtml::HTMLTokenizer::parseRawContent(khtml::TokenizerString&) (htmltokenizer.cpp:379)
==17681==    by 0x1A7FE972: khtml::HTMLTokenizer::parseTag(khtml::TokenizerString&) (htmltokenizer.cpp:1528)
==17681==    by 0x1A7FF15D: khtml::HTMLTokenizer::write(khtml::TokenizerString const&, bool) (htmltokenizer.cpp:1797)
==17681==    by 0x1A74AC77: KHTMLPart::write(char const*, int) (khtml_part.cpp:2096)
==17681==    by 0x1A740E71: KHTMLPart::slotRestoreData(QByteArray const&) (khtml_part.cpp:1763)
==17681==    by 0x1A76610E: KHTMLPart::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (khtml_part.moc:255)
==17681==    by 0x78B8306: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3547)


Diffs
-----

  khtml/html/htmlprospectivetokenizer.cpp 0e58709 

Diff: http://git.reviewboard.kde.org/r/105099/diff/


Testing
-------


Thanks,

Bernd Buschinski

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120529/2a2139a1/attachment.htm>


More information about the kde-core-devel mailing list