Prevent Segfault when building with -DNDPI_ENABLE_DEBUG_MESSAGES

This commit is contained in:
Vito Piserchia
2016-11-03 15:23:06 +01:00
parent 61f1ace43f
commit e3d15ef4e7
3 changed files with 20 additions and 13 deletions
+6 -2
View File
@@ -181,13 +181,17 @@
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
#define NDPI_LOG(proto, mod, log_level, args...) \
#define NDPI_LOG(proto, m, log_level, args...) \
{ \
struct ndpi_detection_module_struct *mod = (struct ndpi_detection_module_struct*) m; \
if(mod != NULL) { \
mod->ndpi_debug_print_file=__FILE__; \
mod->ndpi_debug_print_function=__FUNCTION__; \
mod->ndpi_debug_print_line=__LINE__; \
mod->ndpi_debug_printf(proto, mod, log_level, args); \
if (mod->ndpi_debug_printf != NULL) \
mod->ndpi_debug_printf(proto, mod, log_level, args); \
else \
printf(args, proto, mod, log_level); \
} \
}