1. in function alert_debug.c/AlertDebugLogInitCtx, miss deinit function<br><br>OutputCtx *AlertDebugLogInitCtx(ConfNode *conf)<br>{<br>..................<br><br> OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));<br>
if (output_ctx == NULL)<br> return NULL;<br> output_ctx->data = file_ctx;<br> <b style="color: rgb(0, 0, 102);">output_ctx->DeInit=AlertDebugLogDeInitCtx; //iswalker: AlertDebugLogDeInitCtx function NOT defined,so when engine reload dynamicly, file handler will leak</b><br>
<br> return output_ctx;<br>}<br><br><a href="http://2.in">2.in</a> alert_xxx.c files,some xxx-log context init function like xxxLogInitCtx,when some codes return NULL,the mem allocated before return NULL will NOT free,codes as following:<br>
<br>OutputCtx *AlertUnifiedLogInitCtx(ConfNode *conf)<br>{<br> int ret = 0;<br> LogFileCtx* file_ctx=LogFileNewCtx();<br><br> if (file_ctx == NULL) {<br> SCLogError(SC_ERR_MEM_ALLOC, "Couldn't create new file_ctx");<br>
return NULL;<br> }<br><br> <br> i<br> file_ctx->size_limit = limit * 1024 * 1024;<br><br> ret = AlertUnifiedLogOpenFileCtx(file_ctx, filename);<br> if (ret < 0){<br><b style="color: rgb(0, 0, 102);"> LogFileFreeCtx(logfile_ctx); //iswalker, codes should be added</b><br>
return NULL;<br> }<br> OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));<br> if (output_ctx == NULL) {<br> <b style="color: rgb(0, 0, 102);">LogFileFreeCtx(logfile_ctx); //iswalker, codes should be added</b> <br>
return NULL;<br> }<br> output_ctx->data = file_ctx;<br> output_ctx->DeInit = AlertUnifiedLogDeInitCtx;<br><br> SCLogInfo("Unified-log initialized: filename %s, limit %"PRIu32" MB",<br>
filename, limit);<br><br> return output_ctx;<br>}<br>