diff --git a/src/tm-queues.c b/src/tm-queues.c index e549a975c7..b956c71498 100644 --- a/src/tm-queues.c +++ b/src/tm-queues.c @@ -52,7 +52,10 @@ Tmq* TmqCreateQueue(char *name) goto error; Tmq *q = &tmqs[tmq_id]; - q->name = name; + q->name = SCStrdup(name); + if (q->name == NULL) + goto error; + q->id = tmq_id++; /* for cuda purposes */ q->q_type = 0; @@ -90,6 +93,12 @@ void TmqDebugList(void) void TmqResetQueues(void) { + uint16_t i; + for (i = 0; i < TMQ_MAX_QUEUES; i++) { + if (tmqs[i].name) { + SCFree(tmqs[i].name); + } + } memset(&tmqs, 0x00, sizeof(tmqs)); tmq_id = 0; } diff --git a/src/tmqh-flow.c b/src/tmqh-flow.c index c0898ef0af..6ea8917bdb 100644 --- a/src/tmqh-flow.c +++ b/src/tmqh-flow.c @@ -109,7 +109,7 @@ static int StoreQueueId(TmqhFlowCtx *ctx, char *name) void *ptmp; Tmq *tmq = TmqGetQueueByName(name); if (tmq == NULL) { - tmq = TmqCreateQueue(SCStrdup(name)); + tmq = TmqCreateQueue(name); if (tmq == NULL) return -1; }