Avoid using memory after we free it

Without setting errmsg to NULL here, we'll try to print this freed
value again below if another error doesn't intercede.
This commit is contained in:
Travis Cross 2013-05-28 05:28:19 +00:00
parent d7b139f3b4
commit 3c8db7c715
1 changed files with 1 additions and 1 deletions

View File

@ -1676,7 +1676,7 @@ static uint32_t do_trans(switch_sql_queue_manager_t *qm)
switch_cache_db_execute_sql_real(qm->event_db, qm->pre_trans_execute, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL PRE TRANS EXEC %s [%s]\n", qm->pre_trans_execute, errmsg);
free(errmsg);
free(errmsg); errmsg = NULL;
}
}