Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing a few issues found by coverity #393

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,7 @@ handle_routes(NetplanParser* npp, yaml_node_t* node, __unused const void* _, GEr

err:
route_clear(&npp->current.route);
npp->current.route = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: FWIW, I think this nullification is already being done, using the CLEAR_FROM_FREE macro. But I guess it doesn't hurt to do it manually again in the error case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah, that's true. Coverity (and I) wasn't smart enough to see that I guess... well, if nothing, this line will eliminate an issue from the Coverity report.

return FALSE;
}

Expand Down
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
Loading