return SC_OK;
error:
- if (temp_fmt != NULL)
+ if (temp_fmt_h != NULL)
SCFree(temp_fmt_h);
return SC_ERR_SPRINTF;
}
break;
case SC_LOG_OP_IFACE_FILE:
s = getenv(SC_LOG_ENV_LOG_FILE);
- if (s == NULL)
- s = SCLogGetLogFilename(SC_LOG_DEF_LOG_FILE);
-
- op_ifaces_ctx = SCLogInitFileOPIface(s, NULL, SC_LOG_LEVEL_MAX);
+ if (s == NULL) {
+ char *str = SCLogGetLogFilename(SC_LOG_DEF_LOG_FILE);
+ if (str != NULL) {
+ op_ifaces_ctx = SCLogInitFileOPIface(str, NULL, SC_LOG_LEVEL_MAX);
+ SCFree(str);
+ }
+ } else {
+ op_ifaces_ctx = SCLogInitFileOPIface(s, NULL, SC_LOG_LEVEL_MAX);
+ }
break;
case SC_LOG_OP_IFACE_SYSLOG:
s = getenv(SC_LOG_ENV_LOG_FACILITY);
break;
case SC_LOG_OP_IFACE_FILE:
s = getenv(SC_LOG_ENV_LOG_FILE);
- if (s == NULL)
- s = SCLogGetLogFilename(SC_LOG_DEF_LOG_FILE);
- op_ifaces_ctx = SCLogInitFileOPIface(s, NULL, -1);
+ if (s == NULL) {
+ char *str = SCLogGetLogFilename(SC_LOG_DEF_LOG_FILE);
+ if (str != NULL) {
+ op_ifaces_ctx = SCLogInitFileOPIface(str, NULL, SC_LOG_LEVEL_MAX);
+ SCFree(str);
+ }
+ } else {
+ op_ifaces_ctx = SCLogInitFileOPIface(s, NULL, -1);
+ }
break;
case SC_LOG_OP_IFACE_SYSLOG:
s = getenv(SC_LOG_ENV_LOG_FACILITY);