Add some debug output to app-layer-htp.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent 25f5589078
commit 6fca55e068

@ -161,6 +161,7 @@ static void *HTPStateAlloc(void)
SCMutexLock(&htp_state_mem_lock);
htp_state_memcnt++;
htp_state_memuse += sizeof(HtpState);
SCLogDebug("htp memory %"PRIu64" (%"PRIu64")", htp_state_memuse, htp_state_memcnt);
SCMutexUnlock(&htp_state_mem_lock);
#endif
@ -188,6 +189,8 @@ void HTPStateFree(void *state)
/* free the connection parser memory used by HTP library */
if (s != NULL && s->connp != NULL) {
SCLogDebug("freeing HTP state");
size_t i;
/* free the list of body chunks */
if (s->connp->conn != NULL) {
@ -212,6 +215,7 @@ void HTPStateFree(void *state)
SCMutexLock(&htp_state_mem_lock);
htp_state_memcnt--;
htp_state_memuse -= sizeof(HtpState);
SCLogDebug("htp memory %"PRIu64" (%"PRIu64")", htp_state_memuse, htp_state_memcnt);
SCMutexUnlock(&htp_state_mem_lock);
#endif
@ -1088,6 +1092,14 @@ static void HTPConfigure(void)
SCReturn;
}
void AppLayerHtpPrintStats(void) {
#ifdef DEBUG
SCMutexLock(&htp_state_mem_lock);
SCLogInfo("htp memory %"PRIu64" (%"PRIu64")", htp_state_memuse, htp_state_memcnt);
SCMutexUnlock(&htp_state_mem_lock);
#endif
}
static void HtpConfigCreateBackup(void)
{
cfglist_backup.cfg = cfglist.cfg;

@ -122,6 +122,7 @@ void AppLayerHtpRegisterExtraCallbacks(void);
/* To free the state from unittests using app-layer-htp */
void HTPStateFree(void *);
void AppLayerHtpEnableRequestBodyCallback(void);
void AppLayerHtpPrintStats(void);
#endif /* __APP_LAYER_HTP_H__ */

@ -1331,6 +1331,8 @@ int main(int argc, char **argv)
}
#endif
AppLayerHtpPrintStats();
SigCleanSignatures(de_ctx);
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE) {
MpmFactoryDeRegisterAllMpmCtxProfiles();

Loading…
Cancel
Save