[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src ralloc.c
From: |
Jason Rumney |
Subject: |
[Emacs-diffs] emacs/src ralloc.c |
Date: |
Wed, 24 Dec 2008 11:37:12 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Jason Rumney <jasonr> 08/12/24 11:37:12
Modified files:
src : ralloc.c
Log message:
Add comments to explain checks and aborts, to assist future debugging.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ralloc.c?cvsroot=emacs&r1=1.70&r2=1.71
Patches:
Index: ralloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/ralloc.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- ralloc.c 24 Dec 2008 11:20:36 -0000 1.70
+++ ralloc.c 24 Dec 2008 11:37:12 -0000 1.71
@@ -402,6 +402,11 @@
while (p != NIL_BLOC)
{
+ /* Consistency check. Don't return inconsistent blocs.
+ Don't abort here, as callers might be expecting this, but
+ callers that always expect a bloc to be returned should abort
+ if one isn't to avoid a memory corruption bug that is
+ difficult to track down. */
if (p->variable == ptr && p->data == *ptr)
return p;
@@ -981,7 +986,7 @@
dead_bloc = find_bloc (ptr);
if (dead_bloc == NIL_BLOC)
- abort ();
+ abort (); /* Double free? PTR not originally used to allocate? */
free_bloc (dead_bloc);
*ptr = 0;
@@ -1025,7 +1030,7 @@
bloc = find_bloc (ptr);
if (bloc == NIL_BLOC)
- abort ();
+ abort (); /* Already freed? PTR not originally used to allocate? */
if (size < bloc->size)
{
@@ -1246,7 +1251,7 @@
}
if (bloc == NIL_BLOC || bloc->variable != old)
- abort ();
+ abort (); /* Already freed? OLD not originally used to allocate? */
/* Update variable to point to the new location. */
bloc->variable = new;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src ralloc.c,
Jason Rumney <=