Use xcalloc() in hash.c to handle out of memory errors.
authorPaul Smith <psmith@gnu.org>
Fri, 17 May 2013 05:24:19 +0000 (01:24 -0400)
committerPaul Smith <psmith@gnu.org>
Fri, 17 May 2013 05:24:19 +0000 (01:24 -0400)
ChangeLog
hash.c

index d9c3167882f348fb3e2612a765d9892d188467cd..c96281053c5416f88784c4e2a9cb7c07bf6084dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-05-17  Paul Smith  <psmith@gnu.org>
 
+       * hash.c (CALLOC): Use xcalloc() to handle out of memory errors.
+
        * makeint.h: Prototype new unload_file() function.
        * load.c (unload_file): Create a function to unload a file.
        (struct load_list): Type to remember loaded objects.
diff --git a/hash.c b/hash.c
index d1c2facac8ff268d1f011c1fd13ac0fd4a2315e7..ca2d02d66702b589c2823362447c0ca40d039fc9 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -17,7 +17,7 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "makeint.h"
 #include "hash.h"
 
-#define        CALLOC(t, n) ((t *) calloc (sizeof (t), (n)))
+#define        CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
 #define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
 #define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n)))
 #define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n)))