]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage/rsync: free memory on error
authorC0deAi <benjamin.bales@assrc.us>
Fri, 6 Apr 2018 16:46:53 +0000 (12:46 -0400)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 9 Apr 2018 18:40:09 +0000 (20:40 +0200)
Closes #2262.

Signed-off-by: C0deAi <techsupport@mycode.ai>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/storage/rsync.c

index c3080a5684392b9e5e5a87d9cd83e7d9dfacdffe..83871ae803fdbd9643cee79ea6477300f18291af 100644 (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';