From 5f5f96bfc880bb9353deaaf3d77be464755b635b Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 3 Oct 2005 20:32:44 +0000 Subject: [PATCH] * runtime/memory.c (allocate_size): Malloc 1 byte if size == 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104909 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 4 ++++ libgfortran/runtime/memory.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 34b07eb..16bef47 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,7 @@ +2005-10-03 Jakub Jelinek + + * runtime/memory.c (allocate_size): Malloc 1 byte if size == 0. + 2005-10-03 Francois-Xavier Coudert PR libfortran/19308 diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index 4f342c5..d52319f 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -182,7 +182,7 @@ allocate_size (void **mem, size_t size, GFC_INTEGER_4 * stat) if (!mem) runtime_error ("Internal: NULL mem pointer in ALLOCATE."); - newmem = malloc (size); + newmem = malloc (size ? size : 1); if (!newmem) { if (stat) -- 2.7.4