(scm_gc_malloc): Return NULL if requested size is 0.
authorNeil Jerram <neil@ossau.uklinux.net>
Wed, 6 Feb 2008 22:16:35 +0000 (22:16 +0000)
committerNeil Jerram <neil@ossau.uklinux.net>
Wed, 6 Feb 2008 22:16:35 +0000 (22:16 +0000)
(scm_gc_free): Don't call `free' if mem is NULL.

NEWS
THANKS
libguile/ChangeLog
libguile/gc-malloc.c

diff --git a/NEWS b/NEWS
index d70f101d0857c2e90b4d6dd487d1278036721718..c82310351117cee8c53b9c8ebd3f351927a393b1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ called with an associator proc that returns neither a pair nor #f.
 ** Avoid MacOS build problems caused by incorrect combination of "64"
 system and library calls.
 ** Fixed compilation of `numbers.c' with Sun Studio (Solaris 9)
+** Fixed wrong-type-arg errors when creating zero length SRFI-4
+uniform vectors on AIX.
 
 * New modules (see the manual for details)
 
diff --git a/THANKS b/THANKS
index 4ab68e89249d180880331d3d26bcd992c99f891f..035d3ace2868c412cd23e0770a53f11d256b6604 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -77,6 +77,7 @@ For fixes or providing information which led to a fix:
            Alex Shinn
          Daniel Skarda
           Cesar Strauss
+         Rainer Tammer
         Richard Todd
           Issac Trotts
            Greg Troxel
index 84dd8950b1ddbb75735b11d11a7bd7d5e9b0def3..18e473b79dd457773c391d194f156526d984edc5 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-06  Neil Jerram  <neil@ossau.uklinux.net>
+
+       * gc-malloc.c (scm_gc_malloc): Return NULL if requested size is 0.
+       (scm_gc_free): Don't call `free' if mem is NULL.
+
 2008-02-06  Ludovic Courtès  <ludo@gnu.org>
 
        * numbers.c (scm_i_mkbig, scm_i_long2big, scm_i_ulong2big,
index 638944a04a5a36890198d5c4b1df7637d42233fd..6ff8d0c3f121bacea573593c931c30b8d3df5916 100644 (file)
@@ -317,7 +317,7 @@ scm_gc_malloc (size_t size, const char *what)
      to write it the program is killed with signal 11. --hwn
   */
 
-  void *ptr = scm_malloc (size);
+  void *ptr = size ? scm_malloc (size) : NULL;
   scm_gc_register_collectable_memory (ptr, size, what);
   return ptr;
 }
@@ -363,7 +363,8 @@ void
 scm_gc_free (void *mem, size_t size, const char *what)
 {
   scm_gc_unregister_collectable_memory (mem, size, what);
-  free (mem);
+  if (mem)
+    free (mem);
 }
 
 char *