mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
net: fix coverity RESOURCE_LEAK
criu-3.12/criu/net.c:2043: overwrite_var: Overwriting "img" in "img = open_image_at(-1, CR_FD_IP6TABLES, 0UL, pid)" leaks the storage that "img" points to. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
eb732bcf0d
commit
8be1d457d7
1 changed files with 4 additions and 2 deletions
|
|
@ -2090,13 +2090,13 @@ static int restore_ip_dump(int type, int pid, char *cmd)
|
|||
if (written < n) {
|
||||
pr_perror("Failed to write to tmpfile "
|
||||
"[written: %d; total: %d]", written, n);
|
||||
return -1;
|
||||
goto close;
|
||||
}
|
||||
}
|
||||
|
||||
if (fseek(tmp_file, 0, SEEK_SET)) {
|
||||
pr_perror("Failed to set file position to beginning of tmpfile");
|
||||
return -1;
|
||||
goto close;
|
||||
}
|
||||
|
||||
if (img) {
|
||||
|
|
@ -2104,6 +2104,7 @@ static int restore_ip_dump(int type, int pid, char *cmd)
|
|||
close_image(img);
|
||||
}
|
||||
|
||||
close:
|
||||
if(fclose(tmp_file)) {
|
||||
pr_perror("Failed to close tmpfile");
|
||||
}
|
||||
|
|
@ -2208,6 +2209,7 @@ static inline int restore_iptables(int pid)
|
|||
return -1;
|
||||
if (empty_image(img)) {
|
||||
ret = 0;
|
||||
close_image(img);
|
||||
goto ipt6;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue