subr_gtaskqueue: Fix minor leak of tq_name in error case

Reported by:	cppcheck
Sponsored by:	Dell EMC Isilon
This commit is contained in:
cem 2018-03-10 01:01:01 +00:00
parent c4ca702797
commit bde6462cfb

View File

@ -134,8 +134,10 @@ _gtaskqueue_create(const char *name, int mflags,
snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue");
queue = malloc(sizeof(struct gtaskqueue), M_GTASKQUEUE, mflags | M_ZERO);
if (!queue)
if (!queue) {
free(queue->tq_name, M_GTASKQUEUE);
return (NULL);
}
STAILQ_INIT(&queue->tq_queue);
TAILQ_INIT(&queue->tq_active);