We end up leaking listeners that are allocated when a plugin calls NPN_GetURL, with the following stack to the unbalanced addref: NPN_GetURL (/home/bzbarsky/plugins/libflashplayer.so) _geturl (../../../../../mozilla/modules/plugin/base/src/ns4xPlugin.cpp:964) MakeNew4xStreamInternal(_NPP*, char const*, char const*, eNPPStreamTypeInternal, int, void*, unsigned int, char const*, unsigned char) (../../../../../mozilla/modules/plugin/base/src/ns4xPlugin.cpp:928) ns4xPluginInstance::NewNotifyStream(nsIPluginStreamListener**, void*, int, char const*) (../../../../../mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp:1357) And indeed, NewNotifyStream addrefs its our param and the caller never releases it here. Fixing that makes us crash, since ns4xPluginStreamListener::CallURLNotify helpfully calls NS_RELEASE_THIS() with the comment: 235 // Let's not leak this stream listener. Release the reference to the stream listener 236 // added for the notify callback in NewNotifyStream. Problem is, CallURLNotify has several early returns (in non-failure cases, even). So do the methods that call CallURLNotify. The net result is that it's pretty easy for us to leak this whole mess. What I think should happen is that this NS_RELEASE_THIS() should be removed, and that MakeNew4xStreamInternal should be just release its ptr. To make sure this is safe, though, have to trace through the ownership model between this class and ns4xPluginInstance...
Created attachment 191025 [details] [diff] [review] Like this, perhaps? I'm guessing this is 1.9-type stuff at this point.... :(
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? I'm not going to claim I completely understand the ownership model for the objects in question here, but from looking at this change and the surrounding code it *seems* like this is indeed what we want here. r=jst to give this some mileage on the trunk...
12 years ago
12 years ago
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? jst, want to just make this an r+sr?
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? Sure, sr=jst too.
Fixed on trunk.
Is this leak worth fixing for 184.108.40.206 or 1.8.1?
No idea. More importantly, I can't give a risk evaluation here; I have no idea what this patch could break.
JST - thoughts on a branch patch for this?
Seems worth doing. It's been on the trunk long enough IMO, and this patch applies cleanly (though with some offset) to the branch as well so IMO we could just land this.
jst, want to land it now that it's approved?
Fixed on branch. Hadn't realized this got approved...
11 years ago
Comment on attachment 191025 [details] [diff] [review] Like this, perhaps? approved for 1.8.0 branch, a=dveditz for drivers
Fixed for 220.127.116.11
So this caused regression bug 354124... No idea why. :(
If my analysis in bug 354124 is correct, we probably need to back this out of branches.... and add more plug-in tests to whatever pre-release test suites we run, or not touch plug-in code on branches anymore. I also feel that this bug is just another indication that trunk is really not getting enough testing in the various modes we support to base decisions on "there haven't been any problems on trunk".