[lxc-devel] [PATCH] Remove unnecessary call to free()

Christian Brauner christianvanbrauner at gmail.com
Mon Sep 28 20:52:27 UTC 2015


Freeing memory when calloc() fails doesn't make sense

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
---
 src/lxc/lxc_destroy.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c
index 0eeff51..f1830fd 100644
--- a/src/lxc/lxc_destroy.c
+++ b/src/lxc/lxc_destroy.c
@@ -168,7 +168,6 @@ static int do_destroy_with_snapshots(struct lxc_container *c)
 		if (!buf) {
 			SYSERROR("failed to allocate memory");
 			close(fd);
-			free(buf);
 			return -1;
 		}
 
-- 
2.5.3



More information about the lxc-devel mailing list