On Thu May 04 05:07:09 2006, guest wrote:
Show quoted text> Attached test file calls CheckSV twice on the same $handle, causing Perl
> to SEGV.
>
> Tested with 0.03 on both SuSE's perl-5.8.3-32.9 and Debian Sarge's 5.8.8-3
Here is a quick fix for your problem. It only makes it clear that a
$handle is no longer reusable after the first CheckSV() call. It simply
marks $handle value for update when returning from XS (it is freed and set
to NULL in check_used).
Now I have experimental branch in which handles are boxed into
full-fledged objects, with special typemap to prevent "scalar leak" inside
XS code (from the Devel::Leak point of view). However, offhand it is not
obvious what subsequent calls to CheckSV() should actually do. Should
they report the leaks from the start of NoteSV() or rather from the point
of previous CheckSV() call?
So this fix is probably the best we should do at this point. Anyway,
if you know of other bugs in Devel::Leak or somehow interested in further
Devel::Leak development, please let me know.
---
Leak.xs | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Leak.xs b/Leak.xs
index 59b2390..5411f4b 100644
--- a/Leak.xs
+++ b/Leak.xs
@@ -198,9 +198,12 @@ CheckSV(obj)
hash_ptr * obj
CODE:
{
+ if (!obj)
+ croak("invalid Devel::Leak handle (cannot reuse)");
RETVAL = check_used(&obj);
}
OUTPUT:
+ obj
RETVAL
IV
--
1.4.3.GIT