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

Mateusz Guzik mjguzik at gmail.com
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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 25 15:20:07 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Mateusz Guzik
>Release:        8.0-CURRENT
>Organization:
>Environment:
>Description:
seminit() allocates memory for sema_mtx, but semunload() does not free it.
>How-To-Repeat:

>Fix:
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++)
 		mtx_destroy(&sema_mtx[i]);
+	free(sema_mtx, M_SEM);
 	mtx_destroy(&sem_mtx);
 	mtx_destroy(&sem_undo_mtx);
 	return (0);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list