This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Nullify deallocated pointers.
- From: Paul Brook <paul at nowt dot org>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Sat, 29 Nov 2003 13:14:31 +0000
- Subject: [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;