I originally wrote the bit of code that didn't clean up after itself,
so I'll take full responsibility for this particular leak-plugging.

On VMS we need a "helper" command-language script for i/o piping;
part of the Perl initialization on VMS is to make a list of places
where such a helper script might be found (i.e., in the original @INC,
in the same directory as $^X, in the user's home directory) *before*
the script gets a chance to mess things up.  (Security, donchaknow)

But while it would have been very perlish to store the list in an AV,
I wasn't up to attempting that at the time. Instead I just used a
simple linked list.  (Even now, it's not clear to me that an AV would
be an advantage, since one point of the whole exercise is to keep the
list away from scripts messing with it).

But the linked list wasn't freed when the interpreter exits.  So here's
a patch to do that.   Apply to 5.7.0 and to any post-5.6.0 that has
the "VMS piping fix".

diff -uBb vms/vms.c-orig vms/vms.c
--- vms/vms.c-orig      Thu Mar  1 14:57:18 2001
+++ vms/vms.c   Thu Mar  1 14:42:30 2001
@@ -1716,6 +1716,18 @@
 };
 static pPLOC  head_PLOC = 0;
 
+void
+free_pipelocs(void *head)
+{
+    pPLOC p, pnext;
+
+    p = (pPLOC) head;
+    while (p) {
+        pnext = p->next;
+        Safefree(p);
+        p = pnext;
+    }
+}
 
 static void
 store_pipelocs()
@@ -1782,7 +1795,7 @@
         p->dir[NAM$C_MAXRSS] = '\0';
     }
 #endif
-
+    Perl_call_atexit(&free_pipelocs, head_PLOC);
 }
 
 
--
 Drexel University       \V                    --Chuck Lane
======]---------->--------*------------<-------[===========
     (215) 895-1545     _/ \  Particle Physics
FAX: (215) 895-5934     /\ /~~~~~~~~~~~        [EMAIL PROTECTED]

Reply via email to