From: Nick Ing-Simmons <nik@tiuk.ti.com>
Date: Sat, 20 Oct 2001 22:23:53 +0000 (+0000)
Subject: Fix typos in new locking on MemShared
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fcdafbdb0bffcc321d3a9c54e5d13442d621313;p=p5sagit%2Fp5-mst-13.2.git

Fix typos in new locking on MemShared
Make buffers in PerlIOBuf_* in per-thread heap (they are cloned after all...)
- seems to make segfaults more deterministic - suspect they are
  attempt to free() after Interp and Host have gone.

p4raw-id: //depot/perlio@12541
---

diff --git a/perlio.c b/perlio.c
index c33045c..f1cddb3 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3058,7 +3058,7 @@ PerlIOBuf_close(PerlIO *f)
     IV code = PerlIOBase_close(f);
     PerlIOBuf *b = PerlIOSelf(f, PerlIOBuf);
     if (b->buf && b->buf != (STDCHAR *) & b->oneword) {
-	PerlMemShared_free(b->buf);
+	safefree(b->buf);
     }
     b->buf = NULL;
     b->ptr = b->end = b->buf;
@@ -3093,7 +3093,8 @@ PerlIOBuf_get_base(PerlIO *f)
     if (!b->buf) {
 	if (!b->bufsiz)
 	    b->bufsiz = 4096;
-	b->buf = PerlMemShared_calloc(b->bufsiz, sizeof(STDCHAR));
+	b->buf = 
+	Newz('B',b->buf,b->bufsiz, STDCHAR);
 	if (!b->buf) {
 	    b->buf = (STDCHAR *) & b->oneword;
 	    b->bufsiz = sizeof(b->oneword);
@@ -4222,3 +4223,4 @@ PerlIO_sprintf(char *s, int n, const char *fmt, ...)
     return result;
 }
 #endif
+
diff --git a/win32/perlhost.h b/win32/perlhost.h
index 268a112..cd433fd 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -78,7 +78,7 @@ public:
 	void *result;
 	GetLockShared();
 	result = m_pVMemShared->Malloc(size);
-	FreeLockShared()
+	FreeLockShared();
 	return result;
     };
     inline void* ReallocShared(void* ptr, size_t size)
@@ -86,14 +86,14 @@ public:
 	void *result;
 	GetLockShared();
 	result = m_pVMemShared->Realloc(ptr, size);
-	FreeLockShared()
+	FreeLockShared();
 	return result;
     };
     inline void FreeShared(void* ptr)
     {
 	GetLockShared();
 	m_pVMemShared->Free(ptr);
-	FreeLockShared()
+	FreeLockShared();
     };
     inline void* CallocShared(size_t num, size_t size)
     {