diff --git a/libisofs/messages.c b/libisofs/messages.c index 74a9c1d..d326675 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -247,9 +247,8 @@ void iso_msg_debug(int imgid, const char *fmt, ...) { char *msg = NULL; va_list ap; - int ret; - LIBISO_ALLOC_MEM(msg, char, MAX_MSG_LEN); + LIBISO_ALLOC_MEM_VOID(msg, char, MAX_MSG_LEN); va_start(ap, fmt); vsnprintf(msg, MAX_MSG_LEN, fmt, ap); va_end(ap); diff --git a/libisofs/util.h b/libisofs/util.h index 7afc632..8bcaef1 100644 --- a/libisofs/util.h +++ b/libisofs/util.h @@ -547,6 +547,12 @@ void *iso_alloc_mem(size_t size, size_t count, int flag); ret= ISO_OUT_OF_MEM; goto ex; \ } } +#define LIBISO_ALLOC_MEM_VOID(pt, typ, count) { \ + pt= (typ *) iso_alloc_mem(sizeof(typ), (size_t) (count), 0); \ + if(pt == NULL) { \ + goto ex; \ + } } + #define LIBISO_FREE_MEM(pt) { \ if(pt != NULL) \ free((char *) pt); \