[win32] fix memory leaks in offer_nice_chunk()
Gurusamy Sarathy [Sun, 5 Apr 1998 23:32:33 +0000 (23:32 +0000)]
p4raw-id: //depot/win32/perl@882

perl.h
sv.c

diff --git a/perl.h b/perl.h
index cd0f2bb..27e7241 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2063,6 +2063,9 @@ enum {
            nice_chunk = (char*)(chunk);                \
            nice_chunk_size = (chunk_size);             \
        }                                               \
+       else {                                          \
+           Safefree(chunk);                            \
+       }                                               \
        UNLOCK_SV_MUTEX;                                \
     } while (0)
 
diff --git a/sv.c b/sv.c
index 2711551..ff99867 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -400,6 +400,10 @@ sv_free_arenas(void)
            Safefree((void *)sva);
     }
 
+    if (nice_chunk)
+       Safefree(nice_chunk);
+    nice_chunk = Nullch;
+    nice_chunk_size = 0;
     sv_arenaroot = 0;
     sv_root = 0;
 }