diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-12-12 14:15:01 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-12-12 14:15:01 +0000 |
commit | 0fd0b827814d52809392983f5024b741dad46831 (patch) | |
tree | c11e2a038a394df2ee54398f6f49a9de7d02764f /sys/kern/sysv_sem.c | |
parent | 03c2bd73a6aa0846454030185abbda51d20d7525 (diff) |
free(9) sizes for SVID semaphores.
ok bluhm@, visa@
Diffstat (limited to 'sys/kern/sysv_sem.c')
-rw-r--r-- | sys/kern/sysv_sem.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 62e97e3dcbf..157d1ef2ef4 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_sem.c,v 1.53 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: sysv_sem.c,v 1.54 2018/12/12 14:15:00 mpi Exp $ */ /* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */ /* @@ -275,7 +275,8 @@ semctl1(struct proc *p, int semid, int semnum, int cmd, union semun *arg, semaptr->sem_perm.cuid = cred->cr_uid; semaptr->sem_perm.uid = cred->cr_uid; semtot -= semaptr->sem_nsems; - free(semaptr->sem_base, M_SEM, 0); + free(semaptr->sem_base, M_SEM, + semaptr->sem_nsems * sizeof(struct sem)); pool_put(&sema_pool, semaptr); sema[ix] = NULL; semundo_clear(ix, -1); @@ -881,8 +882,8 @@ sysctl_sysvsem(int *name, u_int namelen, void *oldp, size_t *oldlenp, M_WAITOK|M_ZERO); memcpy(newseqs, semseqs, seminfo.semmni * sizeof(unsigned short)); - free(sema, M_SEM, 0); - free(semseqs, M_SEM, 0); + free(sema, M_SEM, seminfo.semmni * sizeof(struct semid_ds *)); + free(semseqs, M_SEM, seminfo.semmni * sizeof(unsigned short)); sema = sema_new; semseqs = newseqs; seminfo.semmni = val; |