From 94644d862c9a54a5ebe8265fbba04bdd0c973065 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 11 Aug 2019 19:23:23 +0300 Subject: [PATCH] Fix garbage collection * src/alloc.c (free_cons): Avoid false positives in INT_ADD_WRAPV. (Bug#37006) --- src/alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index 5e089311a27..d9022ac46c3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2542,7 +2542,9 @@ free_cons (struct Lisp_Cons *ptr) ptr->u.s.u.chain = cons_free_list; ptr->u.s.car = dead_object (); cons_free_list = ptr; - if (INT_ADD_WRAPV (consing_until_gc, sizeof *ptr, &consing_until_gc)) + if (consing_until_gc <= 0) + consing_until_gc += sizeof *ptr; + else if (INT_ADD_WRAPV (consing_until_gc, sizeof *ptr, &consing_until_gc)) consing_until_gc = OBJECT_CT_MAX; gcstat.total_free_conses++; } -- 2.39.2