[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] sched_rt: fix memory leak in rt_init()



commit d17547414199f4434289f75ab2b1364cc961982e
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Jun 8 14:13:23 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jun 8 14:13:23 2015 +0200

    sched_rt: fix memory leak in rt_init()
    
    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@xxxxxxxxxx>
    Coverity-ID: 1304398
    Reviewed-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
---
 xen/common/sched_rt.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

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 @@ rt_init(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 @@ rt_init(struct scheduler *ops)
     ops->sched_data = prv;
 
     return 0;
+
+ no_mem:
+    xfree(prv);
+    return -ENOMEM;
 }
 
 static void
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.