storage/rsync: free memory on error

Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
C0deAi 2018-04-06 12:46:53 -04:00 committed by Christian Brauner
parent 125a2e044c
commit 55d83a7c72
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -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';