mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Adjust the creation of tq_name so it can be freed correctly
Reviewed by: jhb, allanjude Differential Revision: D6454
This commit is contained in:
parent
352427b341
commit
7e52504fc2
2 changed files with 9 additions and 7 deletions
|
|
@ -128,16 +128,17 @@ _taskqueue_create(const char *name, int mflags,
|
|||
int mtxflags, const char *mtxname __unused)
|
||||
{
|
||||
struct taskqueue *queue;
|
||||
char *tq_name = NULL;
|
||||
char *tq_name;
|
||||
|
||||
if (name != NULL)
|
||||
tq_name = strndup(name, 32, M_TASKQUEUE);
|
||||
if (tq_name == NULL)
|
||||
tq_name = "taskqueue";
|
||||
tq_name = malloc(TASKQUEUE_NAMELEN, M_TASKQUEUE, mflags | M_ZERO);
|
||||
if (!tq_name)
|
||||
return (NULL);
|
||||
|
||||
snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue");
|
||||
|
||||
queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | M_ZERO);
|
||||
if (!queue)
|
||||
return NULL;
|
||||
return (NULL);
|
||||
|
||||
STAILQ_INIT(&queue->tq_queue);
|
||||
TAILQ_INIT(&queue->tq_active);
|
||||
|
|
@ -153,7 +154,7 @@ _taskqueue_create(const char *name, int mflags,
|
|||
queue->tq_flags |= TQ_FLAGS_UNLOCKED_ENQUEUE;
|
||||
mtx_init(&queue->tq_mutex, tq_name, NULL, mtxflags);
|
||||
|
||||
return queue;
|
||||
return (queue);
|
||||
}
|
||||
|
||||
struct taskqueue *
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ enum taskqueue_callback_type {
|
|||
#define TASKQUEUE_CALLBACK_TYPE_MIN TASKQUEUE_CALLBACK_TYPE_INIT
|
||||
#define TASKQUEUE_CALLBACK_TYPE_MAX TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
|
||||
#define TASKQUEUE_NUM_CALLBACKS TASKQUEUE_CALLBACK_TYPE_MAX + 1
|
||||
#define TASKQUEUE_NAMELEN 32
|
||||
|
||||
typedef void (*taskqueue_callback_fn)(void *context);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue