kern/133064: [sysv] Missing free(sema_mtx, M_SEM) in sys/kern/sysv_sem.c

Mateusz Guzik mjguzik at
Wed Mar 25 08:20:10 PDT 2009

>Number:         133064
>Category:       kern
>Synopsis:       [sysv] Missing free(sema_mtx, M_SEM) in sys/kern/sysv_sem.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 25 15:20:07 UTC 2009
>Originator:     Mateusz Guzik
>Release:        8.0-CURRENT
seminit() allocates memory for sema_mtx, but semunload() does not free it.

Call free(sema_mtx, M_SEM) in semunload().

Patch attached with submission follows:

--- sysv_sem.c.orig	2009-01-15 12:15:46.000000000 +0000
+++ sysv_sem.c	2009-03-25 14:44:25.000000000 +0000
@@ -285,6 +285,7 @@
 	free(semu, M_SEM);
 	for (i = 0; i < seminfo.semmni; i++)
+	free(sema_mtx, M_SEM);
 	return (0);


More information about the freebsd-bugs mailing list