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

[Xen-changelog] [xen stable-4.2] flask: fix memory leaks



commit 10e715a33f2af819280843cf0bf6a8b619cb7ef9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Feb 13 10:19:20 2014 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 13 10:19:20 2014 +0100

    flask: fix memory leaks
    
    Plus, in the case of security_preserve_bools(), prevent double freeing
    in the case of security_get_bools() failing.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
    master commit: 57c9f2caf05de41913b3e4eb48c0c3ad6c18dd3f
    master date: 2014-02-11 11:11:48 +0100
---
 xen/xsm/flask/flask_op.c    |    1 +
 xen/xsm/flask/ss/services.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index 537d287..a19d3f1 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -347,6 +347,7 @@ static int flask_security_set_bool(struct xen_flask_boolean 
*arg)
 
         if ( arg->bool_id >= num )
         {
+            xfree(values);
             rv = -ENOENT;
             goto out;
         }
diff --git a/xen/xsm/flask/ss/services.c b/xen/xsm/flask/ss/services.c
index c4704c4..5cf9a95 100644
--- a/xen/xsm/flask/ss/services.c
+++ b/xen/xsm/flask/ss/services.c
@@ -1952,6 +1952,7 @@ err:
     {
         for ( i = 0; i < *len; i++ )
             xfree((*names)[i]);
+        xfree(*names);
     }
     xfree(*values);
     goto out;
@@ -2061,7 +2062,7 @@ static int security_preserve_bools(struct policydb *p)
 
     rc = security_get_bools(&nbools, &bnames, &bvalues, NULL);
     if ( rc )
-        goto out;
+        return rc;
     for ( i = 0; i < nbools; i++ )
     {
         booldatum = hashtab_search(p->p_bools.table, bnames[i]);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
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®.