Skip to content

Commit

Permalink
util: prevent calling close() on negative descriptor
Browse files Browse the repository at this point in the history
Coverity IDs: 398341, 398338
  • Loading branch information
daniloegea committed Aug 15, 2023
1 parent 397288f commit 244504b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ netplan_util_dump_yaml_subtree(const char* prefix, int input_fd, int output_fd,
cleanup:
if (input)
fclose(input);
else
else if (in_dup >= 0)
close(in_dup);

if (output)
fclose(output);
else
else if (out_dup >= 0)
close(out_dup);

if (yaml_path)
Expand Down

0 comments on commit 244504b

Please sign in to comment.