]> granicus.if.org Git - gc/commitdiff
Add assertion to GC_enable() ensuring no counter underflow
authorIvan Maidanski <ivmai@mail.ru>
Sun, 9 Dec 2012 19:24:51 +0000 (23:24 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 9 Dec 2012 19:28:32 +0000 (20:28 +0100)
* misc.c (GC_enable): Add assertion against GC_dont_gc underflow.

misc.c

diff --git a/misc.c b/misc.c
index 7d3a1e9f866d2cd2c9b8e7ef57c91a34defe486c..14c43a74c25b4700aa2883f2db294898519f4113 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1726,7 +1726,9 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
 GC_API void GC_CALL GC_enable(void)
 {
     DCL_LOCK_STATE;
+
     LOCK();
+    GC_ASSERT(GC_dont_gc != 0); /* ensure no counter underflow */
     GC_dont_gc--;
     UNLOCK();
 }