User "Tim Starling" posted a comment on MediaWiki.r75452.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/75452#c24866
Commit summary:

added multicast support

Comment:

<pre>
Socket socket;
...
socket = *(new MulticastSocket(any, port, multicastAddr.c_str()));
</pre>

This creates a new MulticastSocket on the heap, copies it member-by-member into 
a Socket object on the stack, and then loses the pointer to the 
MulticastSocket, leaking memory. The resulting object is not a MulticastSocket, 
calling a method on it will result in a call to Socket, not MulticastSocket.

This was partially fixed by r95725, I just thought I'd mention here for future 
reference that this is not how polymorphism in C++ works.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to