Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Mar 2018 01:01:01 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330715 - head/sys/kern
Message-ID:  <201803100101.w2A1116E034440@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Sat Mar 10 01:01:01 2018
New Revision: 330715
URL: https://svnweb.freebsd.org/changeset/base/330715

Log:
  subr_gtaskqueue: Fix minor leak of tq_name in error case
  
  Reported by:	cppcheck
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/kern/subr_gtaskqueue.c

Modified: head/sys/kern/subr_gtaskqueue.c
==============================================================================
--- head/sys/kern/subr_gtaskqueue.c	Sat Mar 10 00:59:48 2018	(r330714)
+++ head/sys/kern/subr_gtaskqueue.c	Sat Mar 10 01:01:01 2018	(r330715)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803100101.w2A1116E034440>