emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/alloc.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c
Date: Sat, 25 Dec 2004 05:44:38 -0500

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.358 emacs/src/alloc.c:1.359
*** emacs/src/alloc.c:1.358     Sat Dec 25 10:13:57 2004
--- emacs/src/alloc.c   Sat Dec 25 10:31:36 2004
***************
*** 601,622 ****
           ((unsigned)(ptr[-4]) << 24))
  
  
! /* The call depth in overrun_check  functions.  Realloc may call both malloc
!    and free.  If realloc calls malloc, this may happen:
!    overrun_check_realloc()
!       -> malloc -> (via hook)_-> emacs_blocked_malloc
!          -> overrun_check_malloc
!             call malloc  (hooks are NULL, so real malloc is called).
!             malloc returns 10000.
!             add overhead, return 10016.
!       <- (back in overrun_check_realloc)
        add overhead again, return 10032
  
     (time passes).
  
!    overrun_check_free(10032)
!      decrease overhed
!      free(10016)  <-  crash, because 10000 is the original pointer.  */
  
  static int check_depth;
  
--- 601,624 ----
           ((unsigned)(ptr[-4]) << 24))
  
  
! /* The call depth in overrun_check functions.  For example, this might happen:
!    xmalloc()
!      overrun_check_malloc()
!        -> malloc -> (via hook)_-> emacs_blocked_malloc
!           -> overrun_check_malloc
!              call malloc  (hooks are NULL, so real malloc is called).
!              malloc returns 10000.
!              add overhead, return 10016.
!       <- (back in overrun_check_malloc)
        add overhead again, return 10032
+    xmalloc returns 10032.
  
     (time passes).
  
!    xfree(10032)
!      overrun_check_free(10032)
!        decrease overhed
!        free(10016)  <-  crash, because 10000 is the original pointer.  */
  
  static int check_depth;
  




reply via email to

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