[lxc-devel] [lxc/master] Mergeable branch for C0deAi fixes
brauner on Github
lxc-bot at linuxcontainers.org
Mon Apr 9 18:41:07 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180409/fdcdf5e3/attachment.bin>
-------------- next part --------------
From 125a2e044cae5528b930d2b914632770d04e7059 Mon Sep 17 00:00:00 2001
From: C0deAi <benjamin.bales at assrc.us>
Date: Fri, 6 Apr 2018 11:30:06 -0400
Subject: [PATCH 1/3] lxc init: remove dead code
Value stored is never read.
Closes #2262.
Signed-off-by: C0deAi <techsupport at mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/cmd/lxc_init.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/lxc/cmd/lxc_init.c b/src/lxc/cmd/lxc_init.c
index a0dabb66a..9168c7878 100644
--- a/src/lxc/cmd/lxc_init.c
+++ b/src/lxc/cmd/lxc_init.c
@@ -150,7 +150,6 @@ static void prevent_forking(void)
SYSERROR("Failed to write to \"%s\"", path);
close(fd);
- fd = -1;
break;
}
From 55d83a7c723a646f044d337e63481004c36a3352 Mon Sep 17 00:00:00 2001
From: C0deAi <benjamin.bales at assrc.us>
Date: Fri, 6 Apr 2018 12:46:53 -0400
Subject: [PATCH 2/3] storage/rsync: free memory on error
Closes #2262.
Signed-off-by: C0deAi <techsupport at mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/storage/rsync.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lxc/storage/rsync.c b/src/lxc/storage/rsync.c
index c3080a568..83871ae80 100644
--- a/src/lxc/storage/rsync.c
+++ b/src/lxc/storage/rsync.c
@@ -73,8 +73,10 @@ int lxc_rsync_exec(const char *src, const char *dest)
return -1;
ret = snprintf(s, l, "%s", src);
- if (ret < 0 || (size_t)ret >= l)
+ if (ret < 0 || (size_t)ret >= l) {
+ free(s);
return -1;
+ }
s[l - 2] = '/';
s[l - 1] = '\0';
From 74269047b49ff3fb9cd152274b2e817a0ad68af6 Mon Sep 17 00:00:00 2001
From: C0deAi <benjamin.bales at assrc.us>
Date: Fri, 6 Apr 2018 12:56:50 -0400
Subject: [PATCH 3/3] tools/utils: free memory on error
Closes #2262.
Signed-off-by: C0deAi <techsupport at mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/tools/tool_utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lxc/tools/tool_utils.c b/src/lxc/tools/tool_utils.c
index ca325456a..71e5036be 100644
--- a/src/lxc/tools/tool_utils.c
+++ b/src/lxc/tools/tool_utils.c
@@ -794,8 +794,11 @@ int lxc_config_define_add(struct lxc_list *defines, char *arg)
return -1;
dent->elem = parse_line(arg);
- if (!dent->elem)
+ if (!dent->elem) {
+ free(dent);
return -1;
+ }
+
lxc_list_add_tail(defines, dent);
return 0;
}
More information about the lxc-devel
mailing list