[PATCH 1/3] LXC: avoid useless memory free in lxcContainerIdentifyCGroups

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

 



when lxcContainerIdentifyCGroups failed, lxcContainerSetupPivortRoot
and lxcContainerSetupExtraMounts will free the memory that allocated
in lxcContainerIdentifyCGroups.

So we need not call lxcContainerCGroupFree when
lxcContainerIdentifyCGroups failed.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/lxc/lxc_container.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 4fbceb4..87de463 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1236,17 +1236,16 @@ static int lxcContainerIdentifyCGroups(struct lxcContainerCGroup **mountsret,
         }
     }
 
-    *mountsret = mounts;
-    *nmountsret = nmounts;
     ret = 0;
 
 cleanup:
+    *mountsret = mounts;
+    *nmountsret = nmounts;
+
     closedir(dh);
     endmntent(procmnt);
     VIR_FREE(path);
 
-    if (ret < 0)
-        lxcContainerCGroupFree(mounts, nmounts);
     return ret;
 }
 
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]