summaryrefslogtreecommitdiff
path: root/dbg_mlc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-04-17 22:23:00 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-04-17 22:48:30 +0300
commit77e63cae89782fb22e6eb0312fe8d9bce9071cda (patch)
tree84d48aa81ba744351c87e97e5a6fe32fb801523a /dbg_mlc.c
parente1186520a52f58a9bac50f16b1fd092d2e199b91 (diff)
downloadbdwgc-77e63cae89782fb22e6eb0312fe8d9bce9071cda.tar.gz
Workaround 'data access w/o lock' code defect FP in GC_incr_bytes_freed
* dbg_mlc.c [LINT2]: Include gc_alloc_ptrs.h. * dbg_mlc.c [LINT2] (GC_debug_free): Use GC_incr_bytes_freed() instead of direct increment of GC_bytes_freed.
Diffstat (limited to 'dbg_mlc.c')
-rw-r--r--dbg_mlc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 186039ce..63e9aef2 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -753,6 +753,10 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_uncollectable(size_t lb,
# endif
#endif
+#ifdef LINT2
+# include "private/gc_alloc_ptrs.h"
+#endif
+
GC_API void GC_CALL GC_debug_free(void * p)
{
ptr_t base;
@@ -822,7 +826,11 @@ GC_API void GC_CALL GC_debug_free(void * p)
/* Update the counter even though the real deallocation */
/* is deferred. */
LOCK();
- GC_bytes_freed += sz;
+# ifdef LINT2
+ GC_incr_bytes_freed((size_t)sz);
+# else
+ GC_bytes_freed += sz;
+# endif
UNLOCK();
}
} /* !GC_find_leak */