s = SvPVX(sv);
if (newlen > SvLEN(sv)) { /* need more room? */
if (SvLEN(sv) && s) {
-#if defined(MYMALLOC) && !defined(PURIFY)
+#if defined(MYMALLOC) && !defined(PURIFY) && !defined(LEAKTEST)
STRLEN l = malloced_size((void*)SvPVX(sv));
if (newlen <= l) {
SvLEN_set(sv, l);
/* Grab the size of the record we're getting */
recsize = SvIV(SvRV(PL_rs));
(void)SvPOK_only(sv); /* Validate pointer */
- /* Make sure we've got the room to yank in the whole thing */
- if (SvLEN(sv) <= recsize + 3) {
- /* No, so make it bigger */
- SvGROW(sv, recsize + 3);
- }
- buffer = SvPVX(sv); /* Get the location of the final buffer */
+ buffer = SvGROW(sv, recsize + 1);
/* Go yank in */
#ifdef VMS
/* VMS wants read instead of fread, because fread doesn't respect */
bytesread = PerlIO_read(fp, buffer, recsize);
#endif
SvCUR_set(sv, bytesread);
+ buffer[bytesread] = '\0';
return(SvCUR(sv) ? SvPVX(sv) : Nullch);
}
else if (RsPARA(PL_rs)) {