Suspicous code in KDE 4 trunk r764353

Michael Pyne mpyne at purinchu.net
Tue Jan 22 22:55:59 GMT 2008


On Tuesday 22 January 2008, Christoph Bartoschek wrote:
> Here is what is left from the list:
> -------------------------------------
> - kdemultimedia/juk/sortedstringlist.cpp:163
>
> Line 153 indicates that previousNode could be NULL here.

previousNode cannot be NULL at 163.  The logic is:

For that branch to run, m_root must have been non-zero.
Line 141 assigns node := m_root.  So if m_root was non-zero, so is node.
At line 143, if node is non-zero (true iff m_root was non-zero), previousNode 
is set to a non-zero value (node).

So the only way previousValue would be dereferenced here is if it were proven 
non-zero.

However this shouldn't need to be proved everytime the code is read.  Is 
assertion checking enough to quiet the check?

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080122/1875339f/attachment.sig>


More information about the kde-core-devel mailing list