summaryrefslogtreecommitdiff
path: root/win32/perllib.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-16 03:18:41 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-16 03:18:41 +0000
commit1c0ca838512883f7a705e306f80a7c0a95277a87 (patch)
tree22dcb6bd4b328050cf8bbb56ff33c75af672ddef /win32/perllib.c
parentf433d095c701fc99be6dfb685ceb5f4cb6fafb97 (diff)
downloadperl-1c0ca838512883f7a705e306f80a7c0a95277a87.tar.gz
due to an oversight during PERL_OBJECT migration, hosts created
by pseudo-fork were never being deleted, leading to a sizeable memory leak; std FDs in pseudo-children are now closed automatically to avoid resource leaks; basic infinite looping fork() test works without leaking again in non-PERL_OBJECT build p4raw-id: //depot/perl@5761
Diffstat (limited to 'win32/perllib.c')
-rw-r--r--win32/perllib.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/win32/perllib.c b/win32/perllib.c
index 6211ba7129..857aada247 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -143,6 +143,13 @@ perl_alloc(void)
return my_perl;
}
+EXTERN_C void
+win32_delete_internal_host(void *h)
+{
+ CPerlHost *host = (CPerlHost*)h;
+ delete host;
+}
+
#ifdef PERL_OBJECT
EXTERN_C void
@@ -157,10 +164,7 @@ perl_construct(PerlInterpreter* my_perl)
{
win32_fprintf(stderr, "%s\n",
"Error: Unable to construct data structures");
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
- Perl_free();
- delete pHost;
- PERL_SET_THX(NULL);
+ perl_free(my_perl);
}
}
@@ -185,21 +189,19 @@ EXTERN_C void
perl_free(PerlInterpreter* my_perl)
{
CPerlObj* pPerl = (CPerlObj*)my_perl;
+ void *host = w32_internal_host;
#ifdef DEBUGGING
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
Perl_free();
- delete pHost;
#else
try
{
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
Perl_free();
- delete pHost;
}
catch(...)
{
}
#endif
+ win32_delete_internal_host(host);
PERL_SET_THX(NULL);
}
@@ -207,10 +209,10 @@ EXTERN_C int
perl_run(PerlInterpreter* my_perl)
{
CPerlObj* pPerl = (CPerlObj*)my_perl;
+ int retVal;
#ifdef DEBUGGING
- return Perl_run();
+ retVal = Perl_run();
#else
- int retVal;
try
{
retVal = Perl_run();
@@ -220,8 +222,8 @@ perl_run(PerlInterpreter* my_perl)
win32_fprintf(stderr, "Error: Runtime exception\n");
retVal = -1;
}
- return retVal;
#endif
+ return retVal;
}
EXTERN_C int