This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Nullify deallocated pointers.


Patch below ensures pointers are nullified after deallocation.

Tested on i686-linux.
Applied to tree-ssa branch.

Paul

2003-11-29  Paul Brook  <paul@nowt.org>

	* runtime/memory.c (deallocate): Nullify pointer after freeing.
testsuite
	* gfortran.fortran-torture/execute/allocate.f90: New test.

--- clean/tree-ssa/libgfortran/runtime/memory.c
+++ gcc/libgfortran/runtime/memory.c
@@ -340,6 +340,7 @@ deallocate (void **mem, GFC_INTEGER_4 * 
 
   /* Just use the internal routine.  */
   internal_free (*mem);
+  *mem = NULL;
 
   if (stat)
     *stat = 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]