]>
Commit | Line | Data |
---|---|---|
99be5c8c WB |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: C0deAi <benjamin.bales@assrc.us> | |
3 | Date: Fri, 6 Apr 2018 12:46:53 -0400 | |
4 | Subject: [PATCH] storage/rsync: free memory on error | |
5 | ||
6 | Closes #2262. | |
7 | ||
8 | Signed-off-by: C0deAi <techsupport@mycode.ai> | |
9 | Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> | |
10 | --- | |
11 | src/lxc/storage/rsync.c | 4 +++- | |
12 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
13 | ||
14 | diff --git a/src/lxc/storage/rsync.c b/src/lxc/storage/rsync.c | |
15 | index c3080a56..83871ae8 100644 | |
16 | --- a/src/lxc/storage/rsync.c | |
17 | +++ b/src/lxc/storage/rsync.c | |
18 | @@ -73,8 +73,10 @@ int lxc_rsync_exec(const char *src, const char *dest) | |
19 | return -1; | |
20 | ||
21 | ret = snprintf(s, l, "%s", src); | |
22 | - if (ret < 0 || (size_t)ret >= l) | |
23 | + if (ret < 0 || (size_t)ret >= l) { | |
24 | + free(s); | |
25 | return -1; | |
26 | + } | |
27 | ||
28 | s[l - 2] = '/'; | |
29 | s[l - 1] = '\0'; | |
30 | -- | |
31 | 2.11.0 | |
32 |