From b483e111c412e8baa1b1b6377eee4bb772a9474f Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Wed, 20 Apr 2016 02:09:38 +0000 Subject: [PATCH] kern_rctl: Fix resource leak in error path Ordinarily, rctl_write_outbuf frees 'sb'. However, if we are in low memory conditions we skip past the rctl_write_outbuf. In that case, free 'sb'. Reported by: Coverity CID: 1338539 Sponsored by: EMC / Isilon Storage Division --- sys/kern/kern_rctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c index 7f6ca6326d1e..9232187a255a 100644 --- a/sys/kern/kern_rctl.c +++ b/sys/kern/kern_rctl.c @@ -1866,6 +1866,7 @@ sys_rctl_get_limits(struct thread *td, struct rctl_get_limits_args *uap) RCTL_RUNLOCK(); if (sbuf_error(sb) == ENOMEM) { error = ERANGE; + sbuf_delete(sb); goto out; }