outputs: fix memleaks in the error paths reported by coverity

pull/3534/head
Victor Julien 6 years ago
parent 575fb69a06
commit 15e0f7f5bb

@ -126,7 +126,8 @@ static OutputInitResult AlertSyslogInitCtx(ConfNode *conf)
OutputCtx *output_ctx = SCMalloc(sizeof(OutputCtx));
if (unlikely(output_ctx == NULL)) {
SCLogDebug("AlertSyslogInitCtx: Could not create new OutputCtx");
SCLogDebug("could not create new OutputCtx");
LogFileFreeCtx(logfile_ctx);
return result;
}
memset(output_ctx, 0x00, sizeof(OutputCtx));

@ -1277,15 +1277,14 @@ OutputInitResult Unified2AlertInitCtx(ConfNode *conf)
{
OutputInitResult result = { NULL, false };
int ret = 0;
LogFileCtx* file_ctx = NULL;
OutputCtx* output_ctx = NULL;
HttpXFFCfg *xff_cfg = NULL;
int nostamp = 0;
file_ctx = LogFileNewCtx();
LogFileCtx* file_ctx = LogFileNewCtx();
if (file_ctx == NULL) {
SCLogError(SC_ERR_UNIFIED2_ALERT_GENERIC, "Couldn't create new file_ctx");
goto error;
return result;
}
const char *filename = NULL;
@ -1402,6 +1401,8 @@ OutputInitResult Unified2AlertInitCtx(ConfNode *conf)
return result;
error:
LogFileFreeCtx(file_ctx);
if (xff_cfg != NULL) {
SCFree(xff_cfg);
}

Loading…
Cancel
Save