All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/sched_rc: Fix memory leak in rt_init()
@ 2015-06-05  9:49 Andrew Cooper
  2015-06-05 10:07 ` Dario Faggioli
  2015-06-08 12:19 ` Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-06-05  9:49 UTC (permalink / raw)
  To: Xen-devel
  Cc: Keir Fraser, George Dunlap, Andrew Cooper, Dario Faggioli,
	Meng Xu, Jan Beulich

Introduced by c/s 376bbba "sched_rt: print useful affinity info when dumping".
If the allocation of cpumask failed, prv was leaked.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Coverity-ID: 1304398
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
CC: Meng Xu <mengxu@cis.upenn.edu>
---
 xen/common/sched_rt.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index 5836d27..4372486 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -441,7 +441,7 @@ static inline struct list_head *rt_depletedq(const struct scheduler *ops)
     {
         _cpumask_scratch = xmalloc_array(cpumask_var_t, nr_cpu_ids);
         if ( !_cpumask_scratch )
-            return -ENOMEM;
+            goto no_mem;
     }
     nr_rt_ops++;
 
@@ -455,6 +455,10 @@ static inline struct list_head *rt_depletedq(const struct scheduler *ops)
     ops->sched_data = prv;
 
     return 0;
+
+ no_mem:
+    xfree(prv);
+    return -ENOMEM;
 }
 
 static void
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-08 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05  9:49 [PATCH] xen/sched_rc: Fix memory leak in rt_init() Andrew Cooper
2015-06-05 10:07 ` Dario Faggioli
2015-06-08 12:19 ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.