memory leak fixes

remotes/origin/master-1.0.x
Gurvinder Singh 16 years ago committed by Victor Julien
parent 5c8d90afc8
commit fea277b2aa

@ -317,8 +317,7 @@ int AlertUnifiedAlertOpenFileCtx(LogFileCtx *file_ctx, const char *prefix)
strerror(errno));
ret = -1;
}
if (filename != NULL)
free(filename);
return ret;
}
@ -367,7 +366,6 @@ static int AlertUnifiedAlertTestRotate01(void)
error:
AlertUnifiedAlertThreadDeinit(&tv, data);
if (lf != NULL) LogFileFreeCtx(lf);
if (filename != NULL) free(filename);
return r;
}
#endif /* UNITTESTS */

@ -263,12 +263,7 @@ TmEcode AlertUnifiedLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
error:
/* clear memory */
if (aun != NULL) {
memset(aun, 0, sizeof(AlertUnifiedLogThread));
free(aun);
}
printf("AlertUnifiedLogThreadDeinit done (error)\n");
return TM_ECODE_FAILED;
}
@ -338,8 +333,7 @@ int AlertUnifiedLogOpenFileCtx(LogFileCtx *file_ctx, const char *prefix)
strerror(errno));
ret = -1;
}
if (filename != NULL)
free(filename);
return ret;
}
@ -388,7 +382,6 @@ static int AlertUnifiedLogTestRotate01(void)
error:
AlertUnifiedLogThreadDeinit(&tv, data);
if (lf != NULL) LogFileFreeCtx(lf);
if (filename != NULL) free(filename);
return r;
}
#endif /* UNITTESTS */

@ -604,8 +604,7 @@ int Unified2AlertOpenFileCtx(LogFileCtx *file_ctx, const char *prefix)
strerror(errno));
ret = -1;
}
if (filename != NULL)
free(filename);
return ret;
}

@ -82,7 +82,7 @@ void DetectEngineCtxFree(DetectEngineCtx *de_ctx) {
free(de_ctx->sig_array);
if (de_ctx->class_conf_ht != NULL)
free(de_ctx->class_conf_ht);
HashTableFree(de_ctx->class_conf_ht);
free(de_ctx);
//DetectAddressGroupPrintMemory();
//DetectSigGroupPrintMemory();

@ -79,6 +79,8 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx)
}
if (lf_ctx->prefix != NULL)
free(lf_ctx->prefix);
if(lf_ctx->filename != NULL)
free(lf_ctx->filename);
free(lf_ctx);
ret=1;
}

@ -128,10 +128,7 @@ static inline int SCClassConfInitContext(DetectEngineCtx *de_ctx)
*/
static void SCClassConfDeInitContext(DetectEngineCtx *de_ctx)
{
if (de_ctx->class_conf_ht != NULL) {
HashTableFree(de_ctx->class_conf_ht);
de_ctx->class_conf_ht = NULL;
}
fclose(fd);
default_file_path = SC_CLASS_CONF_DEF_CONF_FILEPATH;
fd = NULL;

Loading…
Cancel
Save