summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-27 17:18:28 -0500
committerDan McGee <dan@archlinux.org>2011-11-01 10:27:31 -0500
commit8b3717ef0d55719337b061b761979a5fd9b48fbc (patch)
tree039e14f61780ad29fef47b0a3aacc08e0d31715c /lib/libalpm
parent6df558177fac6bdcbd60de05038d6e6b7f224bd3 (diff)
downloadpacman-8b3717ef0d55719337b061b761979a5fd9b48fbc.tar.xz
Fix size reported in CALLOC allocation failure message
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 36e4960f..61dc8e55 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -54,7 +54,7 @@
#define ALLOC_FAIL(s) do { fprintf(stderr, "alloc failure: could not allocate %zd bytes\n", s); } while(0)
#define MALLOC(p, s, action) do { p = malloc(s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
-#define CALLOC(p, l, s, action) do { p = calloc(l, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0)
+#define CALLOC(p, l, s, action) do { p = calloc(l, s); if(p == NULL) { ALLOC_FAIL(l * s); action; } } while(0)
/* This strdup macro is NULL safe- copying NULL will yield NULL */
#define STRDUP(r, s, action) do { if(s != NULL) { r = strdup(s); if(r == NULL) { ALLOC_FAIL(strlen(s)); action; } } else { r = NULL; } } while(0)
#define STRNDUP(r, s, l, action) do { if(s != NULL) { r = strndup(s, l); if(r == NULL) { ALLOC_FAIL(strlen(s)); action; } } else { r = NULL; } } while(0)