summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 245c4a50d4..cc3e37a723 100644
--- a/sv.c
+++ b/sv.c
@@ -1118,8 +1118,16 @@ sv_grow(SV* sv, unsigned long newlen)
else
s = SvPVX(sv);
if (newlen > SvLEN(sv)) { /* need more room? */
- if (SvLEN(sv) && s)
+ if (SvLEN(sv) && s) {
+#ifdef MYMALLOC
+ STRLEN l = malloced_size((void*)SvPVX(sv));
+ if (newlen <= l) {
+ SvLEN_set(sv, l);
+ return s;
+ } else
+#endif
Renew(s,newlen,char);
+ }
else
New(703,s,newlen,char);
SvPV_set(sv, s);