fix several problems discovered with code analysis
This commit is contained in:
parent
6a38dce2b8
commit
d193789a2c
|
@ -793,9 +793,9 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
|
|||
|
||||
/* malloc or DIE macros */
|
||||
#ifdef NDEBUG
|
||||
#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr )
|
||||
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr )
|
||||
#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr)
|
||||
#else
|
||||
#if (_MSC_VER >= 1500) // VC9+
|
||||
#define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr);__analysis_assume( ptr )
|
||||
|
|
|
@ -616,6 +616,10 @@ static const char *message_names[] = {
|
|||
"APPLICATION_EXEC_COMPLETE",
|
||||
"PHONE_EVENT",
|
||||
"T38_DESCRIPTION"
|
||||
"UDPTL_MODE",
|
||||
"CLEAR_PROGRESS",
|
||||
"JITTER_BUFFER",
|
||||
"RECOVERY_REFRESH",
|
||||
"INVALID"
|
||||
};
|
||||
|
||||
|
@ -644,8 +648,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
|
|||
message->_line = line;
|
||||
}
|
||||
|
||||
if (message->message_id > SWITCH_MESSAGE_INVALID) {
|
||||
message->message_id = SWITCH_MESSAGE_INVALID;
|
||||
if (message->message_id > SWITCH_MESSAGE_INVALID-1) {
|
||||
message->message_id = SWITCH_MESSAGE_INVALID-1;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
|
||||
|
|
|
@ -2669,7 +2669,7 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
|
|||
/* Save the previous token and move to the next one */
|
||||
range_start = prev;
|
||||
} else if (cur == DOW_ERR) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %td (%.6s)\n", exp, p - exp, p);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %ld (%.6s)\n", exp, (long) (p - exp), p);
|
||||
break;
|
||||
} else {
|
||||
/* Valid day found */
|
||||
|
|
Loading…
Reference in New Issue