aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-10-03 22:32:44 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2005-10-03 22:32:44 +0200
commitbb13c3502be2c6eda1771e10f95f615b71d4d026 (patch)
treea71732c1bc92fbe913952fb458a564c313a1acb4
parent01406f868c6a0e1918ba13307e630219b33e2365 (diff)
downloadgcc-bb13c3502be2c6eda1771e10f95f615b71d4d026.zip
gcc-bb13c3502be2c6eda1771e10f95f615b71d4d026.tar.gz
gcc-bb13c3502be2c6eda1771e10f95f615b71d4d026.tar.bz2
* runtime/memory.c (allocate_size): Malloc 1 byte if size == 0.
From-SVN: r104909
-rw-r--r--libgfortran/ChangeLog4
-rw-r--r--libgfortran/runtime/memory.c2
2 files changed, 5 insertions, 1 deletions
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 <jakub@redhat.com>
+
+ * runtime/memory.c (allocate_size): Malloc 1 byte if size == 0.
+
2005-10-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/19308
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index 4f342c57..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)