mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
util: don't leak cr-img objects (v2)
We need to call close_image() for "empty" images. v2: don't touch generic functiuons Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
490021ef9c
commit
49448676ac
2 changed files with 8 additions and 2 deletions
6
mount.c
6
mount.c
|
|
@ -1250,8 +1250,12 @@ static int tmpfs_restore(struct mount_info *pm)
|
|||
close_image(img);
|
||||
img = open_image(CR_FD_TMPFS_IMG, O_RSTR, pm->mnt_id);
|
||||
}
|
||||
if (!img || empty_image(img))
|
||||
if (!img)
|
||||
return -1;
|
||||
if (empty_image(img)) {
|
||||
close_image(img);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = cr_system(img_raw_fd(img), -1, -1, "tar",
|
||||
(char *[]) {"tar", "--extract", "--gzip",
|
||||
|
|
|
|||
4
net.c
4
net.c
|
|
@ -729,8 +729,10 @@ static int restore_ip_dump(int type, int pid, char *cmd)
|
|||
struct cr_img *img;
|
||||
|
||||
img = open_image(type, O_RSTR, pid);
|
||||
if (empty_image(img))
|
||||
if (empty_image(img)) {
|
||||
close_image(img);
|
||||
return 0;
|
||||
}
|
||||
if (img) {
|
||||
ret = run_ip_tool(cmd, "restore", NULL, img_raw_fd(img), -1, 0);
|
||||
close_image(img);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue