diff options
author | Dan McGee <dan@archlinux.org> | 2011-10-28 00:18:28 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-11-01 16:27:31 +0100 |
commit | 8b3717ef0d55719337b061b761979a5fd9b48fbc (patch) | |
tree | 039e14f61780ad29fef47b0a3aacc08e0d31715c | |
parent | 6df558177fac6bdcbd60de05038d6e6b7f224bd3 (diff) | |
download | pacman-8b3717ef0d55719337b061b761979a5fd9b48fbc.tar.gz pacman-8b3717ef0d55719337b061b761979a5fd9b48fbc.tar.xz |
Fix size reported in CALLOC allocation failure message
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | lib/libalpm/util.h | 2 |
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) |