From da311c9d7820b59f379fca7701c151cd1b7becea Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 1 Sep 2009 11:18:11 -0700 Subject: [PATCH] Kernel - add missing crfree() calls to two linux emulation functions --- sys/emulation/linux/linux_misc.c | 4 +++- sys/emulation/linux/linux_uid16.c | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/emulation/linux/linux_misc.c b/sys/emulation/linux/linux_misc.c index 12f2e39f11..5e1e2ab5c9 100644 --- a/sys/emulation/linux/linux_misc.c +++ b/sys/emulation/linux/linux_misc.c @@ -982,8 +982,10 @@ sys_linux_setgroups(struct linux_setgroups_args *args) if (ngrp > 0) { error = copyin((caddr_t)args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t)); - if (error) + if (error) { + crfree(newcred); return (error); + } newcred->cr_ngroups = ngrp + 1; diff --git a/sys/emulation/linux/linux_uid16.c b/sys/emulation/linux/linux_uid16.c index 2d495ea50f..35054b69ab 100644 --- a/sys/emulation/linux/linux_uid16.c +++ b/sys/emulation/linux/linux_uid16.c @@ -131,9 +131,11 @@ sys_linux_setgroups16(struct linux_setgroups16_args *args) newcred = crdup(oldcred); if (ngrp > 0) { error = copyin((caddr_t)args->gidset, linux_gidset, - ngrp * sizeof(l_gid16_t)); - if (error) + ngrp * sizeof(l_gid16_t)); + if (error) { + crfree(newcred); return (error); + } newcred->cr_ngroups = ngrp + 1; @@ -143,9 +145,9 @@ sys_linux_setgroups16(struct linux_setgroups16_args *args) bsd_gidset[ngrp + 1] = linux_gidset[ngrp]; ngrp--; } - } - else + } else { newcred->cr_ngroups = 1; + } setsugid(); p->p_ucred = newcred; -- 2.11.4.GIT