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

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



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 cn fujitsu com>
---
 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


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