mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 09:01:09 +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)
|
* up)
|
||||||
*/
|
*/
|
||||||
lastslash = strrchr(ndelta, '/');
|
lastslash = strrchr(ndelta, '/');
|
||||||
if (!lastslash)
|
if (!lastslash) {
|
||||||
|
free(osrc);
|
||||||
|
free(ndelta);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
lastslash++;
|
lastslash++;
|
||||||
lastslashidx = lastslash - ndelta;
|
lastslashidx = lastslash - ndelta;
|
||||||
|
|
||||||
work = malloc(lastslashidx + 7);
|
work = malloc(lastslashidx + 7);
|
||||||
if (!work)
|
if (!work) {
|
||||||
|
free(osrc);
|
||||||
|
free(ndelta);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
strncpy(work, ndelta, lastslashidx + 1);
|
strncpy(work, ndelta, lastslashidx + 1);
|
||||||
strcpy(work + lastslashidx, "olwork");
|
strcpy(work + lastslashidx, "olwork");
|
||||||
if ((mkdir(work, 0755) < 0) && errno != EEXIST) {
|
if ((mkdir(work, 0755) < 0) && errno != EEXIST) {
|
||||||
SYSERROR("error: mkdir %s", work);
|
SYSERROR("error: mkdir %s", work);
|
||||||
|
free(osrc);
|
||||||
|
free(ndelta);
|
||||||
free(work);
|
free(work);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user