This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id:
66453
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
s.schoeling [...] linet-services.de
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
0.54
Fixed in:
0.81



Subject: SetDiag(xse) leaks without object
Date: Mon, 07 Mar 2011 18:47:25 +0100
To: bug-Text-CSV_XS@rt.cpan.org
From: Sven Schöling <s.schoeling@linet-services.de>
Can be reproduced by both of these oneliners, the first leaks about 200 bytes per iteration, the second one floods the physical memory in a few seconds. perl -MText::CSV_XS -e 'Text::CSV_XS->new while 1' perl -MText::CSV_XS -e 'Text::CSV_XS::SetDiag(undef, 0) while 1' If SetDiag is called without an object the diag is just put on the stack, but not mortalized. A patch is attached which fixes this. Method calls to SetDiag should not be affected. Found on Ubuntu 9.04: Text-CSV_XS-0.80 perl v5.10.0 built for x86_64-linux-gnu-thread-multi System: Linux ls-bs-ws15 2.6.31.1 #1 SMP Fri Oct 2 13:05:50 CEST 2009 x86_64 GNU/Linux Tested with http://repo.or.cz/r/Text-CSV_XS.git e07a35df688ccf484d75782397b11f92b7586e03. -- Sven Schöling Entwickler LINET Services GmbH | Am Alten Bahnhof 4b | 38122 Braunschweig Tel. 0531-180508-0 | Fax 0531-180508-29 | http://www.linet-services.de Geschäftsführung: Philip Reetz und Torsten Börner HR B 9170 Amtsgericht Braunschweig ----------------------------------------------------
From 5de874e10af912bd8765095100d7d7f8858838c0 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Sven=20Sch=C3=B6ling?= <s.schoeling@linet-services.de> Date: Mon, 7 Mar 2011 18:39:21 +0100 Subject: [PATCH] SetDiag was leaking. If SetDiag was called without an object the diag is just put on the stack, but not mortalized. Happened twice for each new Text::CSV_XS object. Reproduce with either of: perl -MText::CSV_XS -e 'Text::CSV_XS->new while 1' perl -MText::CSV_XS -e 'Text::CSV_XS::SetDiag(undef, 0) while 1' --- CSV_XS.xs | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/CSV_XS.xs b/CSV_XS.xs index ab21164..53a9297 100644 --- a/CSV_XS.xs +++ b/CSV_XS.xs @@ -1557,7 +1557,7 @@ SetDiag (self, xse, ...) ST (0) = SetDiag (&csv, xse); } else - ST (0) = SvDiag (xse); + ST (0) = sv_2mortal (SvDiag (xse)); if (xse && items > 1 && SvPOK (ST (2))) { sv_setpvn (ST (0), SvPVX (ST (2)), SvCUR (ST (2))); -- 1.6.0.4
Thanks applied and pushed. Will be in next release.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.