2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

parasite: take into account the fact that a file descriptor can be zero

6. Condition "rst > 0", taking false branch
7. off_by_one: Testing whether handle "rst" is strictly greater than
   zero is suspicious. Did you intend to include equality with zero?
   "rst" leaks when it is zero.

CID 1072986 (#3 of 4): Resource leak (RESOURCE_LEAK)
12. leaked_handle: Handle variable "rst" going out of scope leaks the
handle.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2013-09-03 14:58:13 +04:00
committed by Pavel Emelyanov
parent fd81748a00
commit c8f22f96ed

View File

@@ -360,7 +360,7 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
if (ssock < 0)
pr_perror("Can't create socket");
if (rst > 0 && restore_ns(rst, &net_ns_desc) < 0)
if (rst >= 0 && restore_ns(rst, &net_ns_desc) < 0)
return -1;
if (ssock < 0)
return -1;