Bug 91055

Summary: poppler SplashFontSrc leaking in SplashOutputDev::doUpdateFont
Product: poppler Reporter: Dmytro Morgun <lztoad>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: lztoad
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: This is suggested patch/fix for poppler/SplashOutputDev.cc
patch for SplashFontEngine.cc unref is back to windows

Description Dmytro Morgun 2015-06-22 09:36:43 UTC
Created attachment 116648 [details]
This is suggested patch/fix for poppler/SplashOutputDev.cc

This fontsrc local variable in SplashOutputDev::doUpdateFont leaks memory.
I don't really undestand the code, however, looks like it just needs to be unreferenced regardless of if it is file.
Attached is the patch for poppler/SplashOutputDev.cc
Comment 1 Albert Astals Cid 2015-07-05 22:50:27 UTC
I guess this is a windows only problem, for the rest of platforms we're already unref'ing it in SplashFontEngine::load* inside a 
#ifndef _WIN32

If we add that unref wholesale as you suggest we're double freeing in non windows platforms so you'll need to propose a better patch, either adding the unref only for windows or seeing if we can actually remove those #ifndef _WIN32 in the  SplashFontEngine::load* functions
Comment 2 Dmytro Morgun 2015-07-07 09:10:27 UTC
Removing the ifndef for windows worked fine for me. I haven't run all the test, though (only some set of files we need), but I can't see why windows is any different here.
Comment 3 Dmytro Morgun 2015-07-07 09:12:14 UTC
Created attachment 116992 [details]
patch for SplashFontEngine.cc unref is back to windows

It leaked under windows without this unref and works fine (at least for some fonts) with it.
Comment 4 Albert Astals Cid 2015-07-14 22:27:07 UTC
i have no way to test this, so i'll just trust you

Pushed
Comment 5 Dmytro Morgun 2015-07-15 08:09:59 UTC
Thanks. I'm quite confident it at least will not make things worse. I'd like to help if something will go wrong, but I'm unlikely to monitor poppler bugs, just will stay subscribed to this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.