Closed Bug 980625 Opened 6 years ago Closed 6 years ago

Plugin child leaks detected by LSAN

Categories

(Core :: Plug-ins, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: mccr8, Assigned: johns)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lsan])

Attachments

(5 files, 2 obsolete files)

Attached file m1plugins.txt
This is from an M1 run.  I don't know how important this might be.
There appear to be two leaks here, neither very serious:
- No destructor cleans up various things created in PluginModuleChild::Init. ModuleChild is 1:1 with the process so these isn't "really" a leak
- The test plugin, which is only used in the test suite, has a leak in scriptableHasProperty.
Fixes the nptest leak
Fixes Init leak - nsPluginFile is a struct, needs to have FreePluginInfo() called on it
for the record, one or both of these patches don't seem to build
This at least makes it compile (not actually a patch):
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -182,7 +182,7 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
-    FreePluginInfo(info);
+    pluginFile.FreePluginInfo(info);
These patches do fix the leaks I was seeing.  There's still this from the plugin process, but it is pretty useless:
Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x440995 in malloc (/home/amccreight/ff-dbg-asan/dist/bin/plugin-container+0x440995)
    #1 0x7f023901ee08 in moz_xmalloc /home/amccreight/mc/memory/mozalloc/mozalloc.cpp:52
Version that compiles
Attachment #8387242 - Attachment is obsolete: true
Version that ACTUALLY compiles after I attached the same exact patch twice!
Attachment #8387867 - Attachment is obsolete: true
Attachment #8387237 - Flags: review?(joshmoz)
Attachment #8387870 - Flags: review?(joshmoz)
Assignee: nobody → jschoenick
Status: NEW → ASSIGNED
Here's another test plugin leak:

Direct leak of 835 byte(s) in 17 object(s) allocated from:
    #0 0x446395 in malloc /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0x7f5f48635b3d in moz_xmalloc /builds/slave/try-l64-asan-00000000000000000/build/memory/mozalloc/mozalloc.cpp:52
    #2 0x7f5f1a9e9d33 in c_str /builds/slave/try-l64-asan-00000000000000000/build/dom/plugins/test/testplugin/javaplugin/../nptest.cpp:1770
    #3 0x7f5f1a9e9d33 in getJavaCodebase(NPObject*, _NPVariant const*, unsigned int, _NPVariant*) /builds/slave/try-l64-asan-00000000000000000/build/dom/plugins/test/testplugin/javaplugin/../nptest.cpp:2914
    #4 0x7f5f1a9d5190 in scriptableInvoke(NPObject*, void*, _NPVariant const*, unsigned int, _NPVariant*) /builds/slave/try-l64-asan-00000000000000000/build/dom/plugins/test/testplugin/javaplugin/../nptest.cpp:2005
19   #5 0x7f5f404f6e66 in CallNPMethodInternal(JSContext*, JS::Handle<JSObject*>, unsigned int, JS::Value*, JS::Value*, bool) /builds/slave/try-l64-asan-00000000000000000/build/dom/plugins/base/nsJSNPRuntime.cpp:1393
It's everywhere!
Attachment #8389340 - Flags: review?(joshmoz)
This macro expansion will double-evaluate NPN_StrDup and leak a string
Attachment #8389346 - Flags: review?(joshmoz)
Attachment #8389340 - Flags: review?(joshmoz) → review+
Attachment #8389346 - Flags: review?(joshmoz) → review+
Attachment #8387237 - Flags: review?(joshmoz) → review+
Attachment #8387870 - Flags: review?(joshmoz) → review+
You need to log in before you can comment on or make changes to this bug.