emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 033811c: Fix double-decrement bug when freeing gl


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 033811c: Fix double-decrement bug when freeing global refs
Date: Fri, 20 Nov 2015 21:49:20 +0000

branch: emacs-25
commit 033811ceec6a2b1cb12c14cb932c0bf583e79020
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix double-decrement bug when freeing global refs
    
    * src/emacs-module.c (module_free_global_ref): Add a FIXME
    comment about error reporting.  Fix a recently-introduced typo
    that double-decremented the refcount.
---
 src/emacs-module.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index 84072b9..e730ca3 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -293,6 +293,8 @@ module_free_global_ref (emacs_env *env, emacs_value ref)
   check_main_thread ();
   eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return);
   /* TODO: This probably never signals.  */
+  /* FIXME: Wait a minute.  Shouldn't this function report an error if
+     the hash lookup fails?  */
   MODULE_HANDLE_SIGNALS_VOID;
   eassert (HASH_TABLE_P (Vmodule_refs_hash));
   struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash);
@@ -307,7 +309,7 @@ module_free_global_ref (emacs_env *env, emacs_value ref)
       EMACS_INT refcount = XFASTINT (value) - 1;
       if (refcount > 0)
         {
-          value = make_natnum (refcount - 1);
+          value = make_natnum (refcount);
           set_hash_value_slot (h, i, value);
         }
       else



reply via email to

[Prev in Thread] Current Thread [Next in Thread]