Skip to content

Commit

Permalink
storage/rsync: free memory on error
Browse files Browse the repository at this point in the history
Closes lxc#2262.

Signed-off-by: C0deAi <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
C0deAi authored and Christian Brauner committed Apr 9, 2018
1 parent 125a2e0 commit 55d83a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lxc/storage/rsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 55d83a7

Please sign in to comment.