/* Block-relocating memory allocator.
Copyright (C) 1993, 1995, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifdef emacs
#include <config.h>
+#include <setjmp.h>
#include "lisp.h" /* Needed for VALBITS. */
#include "blockinput.h"
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;
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;
bloc = find_bloc (ptr);
if (bloc == NIL_BLOC)
- abort ();
+ abort (); /* Already freed? PTR not originally used to allocate? */
if (size < bloc->size)
{
}
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;