Subject: | Memory leak in XML::Parser::Expat (with patch) |
There is a memory leak in XML::Parser::Expat in sub parse: it attempts to use the argument as a IO::Handle, and while doing this auto-instantiates a variable named after it. It gets even worse if the variable contains quotes which are interpreted as package name separators.
There was an earlier attempt to fix it by adding a if (defined *{$arg}) but this apparently does not work in all versions of perl, since the problem still appears both in 5.005_03 and in 5.6.1.
The following patch fixes the issue in the above versions:
--- XML-Parser-2.34/Expat/Expat.pm.orig Mon Sep 13 18:06:34 2004
+++ XML-Parser-2.34/Expat/Expat.pm Mon Sep 13 18:06:47 2004
@@ -453,7 +453,7 @@
require IO::Handle;
eval {
no strict 'refs';
- $ioref = *{$arg}{IO} if defined *{$arg};
+ $ioref = *{$arg}{IO} if (ref $args && defined *{$arg});
};
undef $@;
}
Let me know if you need any further information.
Thanks,
Jacques.