From 53c279be1891fa0ba07f90d2a7fccbc36f9cfd2b Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 23 Oct 2015 16:03:47 +0000 Subject: [PATCH] Avoided a potential memory leak with debug messages. Coverity CID 21808. --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index f528139..04901f8 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2015.10.23.140731" +#define Cdrskin_timestamP "2015.10.23.160546" diff --git a/libburn/drive.c b/libburn/drive.c index 1cb7530..47ee4ae 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1893,14 +1893,15 @@ int burn_drive_adr_debug_msg(char *fmt, char *arg) int ret; char *msg = NULL, *msgpt; - BURN_ALLOC_MEM(msg, char, 4096); - msgpt = msg; - if(arg != NULL) - sprintf(msg, fmt, arg); - else - msgpt = fmt; if(libdax_messenger == NULL) return 0; + if(arg != NULL) { + BURN_ALLOC_MEM(msg, char, 4096); + msgpt = msg; + sprintf(msg, fmt, arg); + } else { + msgpt = fmt; + } ret = libdax_msgs_submit(libdax_messenger, -1, 0x00000002, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msgpt, 0, 0);