Avoided a potential memory leak with debug messages. Coverity CID 21808.

This commit is contained in:
Thomas Schmitt 2015-10-23 16:03:47 +00:00
parent caf04416ea
commit 53c279be18
2 changed files with 8 additions and 7 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2015.10.23.140731" #define Cdrskin_timestamP "2015.10.23.160546"

View File

@ -1893,14 +1893,15 @@ int burn_drive_adr_debug_msg(char *fmt, char *arg)
int ret; int ret;
char *msg = NULL, *msgpt; 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) if(libdax_messenger == NULL)
return 0; 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, ret = libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msgpt, 0, 0); msgpt, 0, 0);