mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 17:30:47 +00:00
coverity: ovl_clonepaths: free osrc and ndelta on error paths
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
7d72b9596c
commit
278d97f74a
@ -177,18 +177,26 @@ int ovl_clonepaths(struct bdev *orig, struct bdev *new, const char *oldname,
|
||||
* up)
|
||||
*/
|
||||
lastslash = strrchr(ndelta, '/');
|
||||
if (!lastslash)
|
||||
if (!lastslash) {
|
||||
free(osrc);
|
||||
free(ndelta);
|
||||
return -1;
|
||||
}
|
||||
lastslash++;
|
||||
lastslashidx = lastslash - ndelta;
|
||||
|
||||
work = malloc(lastslashidx + 7);
|
||||
if (!work)
|
||||
if (!work) {
|
||||
free(osrc);
|
||||
free(ndelta);
|
||||
return -1;
|
||||
}
|
||||
strncpy(work, ndelta, lastslashidx + 1);
|
||||
strcpy(work + lastslashidx, "olwork");
|
||||
if ((mkdir(work, 0755) < 0) && errno != EEXIST) {
|
||||
SYSERROR("error: mkdir %s", work);
|
||||
free(osrc);
|
||||
free(ndelta);
|
||||
free(work);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user