By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 1369

Summary: Memory leak into CUPS IPP processing function addStringList_p()
Product: TDE Reporter: Roman Savochenko <rom_as>
Component: tdelibsAssignee: Timothy Pearson <kb9vqf>
Status: RESOLVED FIXED    
Severity: critical CC: bugwatch, darrella, kb9vqf, slavek.banko
Priority: P5    
Version: 3.5.13 [Trinity]   
Hardware: Other   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Attachments: Memory leak fix patch
memoryleak.patch

Description Roman Savochenko 2012-12-21 02:39:55 CST
Created attachment 1060 [details]
Memory leak fix patch

The problem has detected on working KJobViewer into system tray all time. And for about ten printers after 10 hours KJobViewer consume about 120 MB (but start from 15MB). The memory leak place has been detected by ValGrind aid.

Study of the problem shown incorrect placing IPP string attributes into function IppRequest::addStringList_p(). For HAVE_CUPS_1_6 allocated memory by strdup() is not freed by dubling allocation memory into ippSetString() and for < HAVE_CUPS_1_6 is not freed by allocation ommit CUPS infrastructure.

More correct will send values list direct to function ippAddStrings() last argument. Also I think will better make like fix for left functions IppRequest::addIntegerList_p() and IppRequest::addBoolean().

Patch for fix the memory leak included!
Comment 1 Slávek Banko 2012-12-23 12:18:53 CST
I tested the patch with v3.5.13-sru branch and causes FTBFS:

/tmp/buildd/kdelibs-trinity-3.5.13/kdeprint/cups/ipprequest.cpp: In member function 'void IppRequest::addStringList_p(int, int, const QString&, const QStringList&)':
/tmp/buildd/kdelibs-trinity-3.5.13/kdeprint/cups/ipprequest.cpp:242:54: error: cast from 'const char*' to 'int' loses precision [-fpermissive]

Tested on Debian Wheezy (cups 1.5.3) and Ubuntu Quantal (cups 1.6.1) - on both the same crash.
Comment 2 Roman Savochenko 2012-12-31 12:29:23 CST
Created attachment 1072 [details]
memoryleak.patch

Correct patch for x86 and x86_64.
Comment 3 Slávek Banko 2013-01-02 21:58:13 CST
Great. The new patch is fine - not causing FTBFS.
I'll do a basic tests before pushing it to GIT.
Comment 4 Slávek Banko 2013-01-04 20:01:24 CST
Fixed in GIT hash 5f99a271.
Comment 5 Timothy Pearson 2013-01-05 15:56:31 CST
(In reply to comment #4)
> Fixed in GIT hash 5f99a271.

Did you commit this to the R14 development tree?  I don't see it in the tdebase logs...

Thanks!

Tim
Comment 6 Slávek Banko 2013-01-05 18:42:17 CST
(Odpověď na komentář #5)
> (In reply to comment #4)
> > Fixed in GIT hash 5f99a271.
> 
> Did you commit this to the R14 development tree?  I don't see it in the tdebase
> logs...
> 
> Thanks!
> 
> Tim

Yes, of course.
Commit relates to tdelibs:

http://git.trinitydesktop.org/cgit/tdelibs/commit/?id=5f99a2718025c4f2fbef86a450423a9c61e297f9

And I also backported into v3.5.13-sru branch...

http://git.trinitydesktop.org/cgit/tdelibs/commit/?h=origin/v3.5.13-sru&id=bb2a1e349f302299e394ff86f27be3df41f08fb3
Comment 7 Timothy Pearson 2013-01-05 19:23:38 CST
OK, thanks.  I need to find out why the top level GIT tree is not currently updating...
Comment 8 Slávek Banko 2013-01-05 19:27:35 CST
(Odpověď na komentář #7)
> OK, thanks.  I need to find out why the top level GIT tree is not currently
> updating...

...and also "patches" web page is not updated.