diff --git a/src/jbuf/jbuf.c b/src/jbuf/jbuf.c index 0ec70bfe2..bdb9cbf8f 100644 --- a/src/jbuf/jbuf.c +++ b/src/jbuf/jbuf.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -20,7 +19,7 @@ #include #define DEBUG_MODULE "jbuf" -#define DEBUG_LEVEL 5 +#define DEBUG_LEVEL 6 #include @@ -294,7 +293,9 @@ int jbuf_alloc(struct jbuf **jbp, uint32_t min, uint32_t max) err = jbuf_resize(jb, max); #ifdef RE_JBUF_TRACE - (void)re_trace_init("jbuf.json"); + err = re_trace_init("jbuf.json"); + if (err) + DEBUG_WARNING("could not init trace\n"); #endif out: @@ -317,6 +318,9 @@ int jbuf_alloc(struct jbuf **jbp, uint32_t min, uint32_t max) */ int jbuf_resize(struct jbuf *jb, uint32_t packets) { + if (!jb) + return EINVAL; + if (packets <= jb->packets) return EINVAL; diff --git a/src/trace/trace.c b/src/trace/trace.c index 884af188b..e455fb446 100644 --- a/src/trace/trace.c +++ b/src/trace/trace.c @@ -108,6 +108,9 @@ int re_trace_init(const char *json_file) if (!json_file) return EINVAL; + if (trace.init) + return EINVAL; + trace.event_buffer = mem_zalloc( TRACE_BUFFER_SIZE * sizeof(struct trace_event), NULL); if (!trace.event_buffer)