Unverified Commit 55d83a7c by C0deAi Committed by Christian Brauner

storage/rsync: free memory on error

Closes #2262. Signed-off-by: 's avatarC0deAi <techsupport@mycode.ai> Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 125a2e04
...@@ -73,8 +73,10 @@ int lxc_rsync_exec(const char *src, const char *dest) ...@@ -73,8 +73,10 @@ int lxc_rsync_exec(const char *src, const char *dest)
return -1; return -1;
ret = snprintf(s, l, "%s", src); ret = snprintf(s, l, "%s", src);
if (ret < 0 || (size_t)ret >= l) if (ret < 0 || (size_t)ret >= l) {
free(s);
return -1; return -1;
}
s[l - 2] = '/'; s[l - 2] = '/';
s[l - 1] = '\0'; s[l - 1] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment