Commit c8f22f96 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

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: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent fd81748a
...@@ -360,7 +360,7 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid, ...@@ -360,7 +360,7 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
if (ssock < 0) if (ssock < 0)
pr_perror("Can't create socket"); 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; return -1;
if (ssock < 0) if (ssock < 0)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment