aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/runtime/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/runtime/memory.c')
-rw-r--r--libgfortran/runtime/memory.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index efeea86f15a..b18b50532c7 100644
--- a/libgfortran/runtime/memory.c
+++ b/libgfortran/runtime/memory.c
@@ -58,3 +58,17 @@ xcalloc (size_t nmemb, size_t size)
return p;
}
+
+
+void *
+xrealloc (void *ptr, size_t size)
+{
+ if (size == 0)
+ size = 1;
+
+ void *newp = realloc (ptr, size);
+ if (!newp)
+ os_error ("Memory allocation failure in xrealloc");
+
+ return newp;
+}