cvsuser 04/09/07 07:33:55
Modified: build_tools build_nativecall.pl
Log:
Patch up a memory leak with t parameters
Revision Changes Path
1.53 +6 -3 parrot/build_tools/build_nativecall.pl
Index: build_nativecall.pl
===================================================================
RCS file: /cvs/public/parrot/build_tools/build_nativecall.pl,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -w -r1.52 -r1.53
--- build_nativecall.pl 23 Aug 2004 20:31:47 -0000 1.52
+++ build_nativecall.pl 7 Sep 2004 14:33:55 -0000 1.53
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: build_nativecall.pl,v 1.52 2004/08/23 20:31:47 dan Exp $
+# $Id: build_nativecall.pl,v 1.53 2004/09/07 14:33:55 dan Exp $
=head1 NAME
@@ -165,7 +165,7 @@
/* nci.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: build_nativecall.pl,v 1.52 2004/08/23 20:31:47 dan Exp $
+ * $Id: build_nativecall.pl,v 1.53 2004/09/07 14:33:55 dan Exp $
* Overview:
* Native Call Interface routines. The code needed to build a
* parrot to C call frame is in here
@@ -355,7 +355,10 @@
return "(double)REG_NUM($regnum)";
};
/t/ && do {my $regnum = $reg_ref->{s}++;
- return "string_to_cstring(interpreter, REG_STR($regnum))";
+ my $tempnum = $tempcounter++;
+ push @extra_preamble, "char *tempvar$tempnum =
string_to_cstring(interpreter, REG_STR($regnum));\n";
+ push @extra_postamble, "Parrot_free_cstring(tempvar$tempnum);\n";
+ return "tempvar$tempnum";
};
/b/ && do {my $regnum = $reg_ref->{s}++;
return "PObj_bufstart(REG_STR($regnum))";