-
Notifications
You must be signed in to change notification settings - Fork 201
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
Fixing Coverity issues #383
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This condition is always false. Found by Coverity.
As we don't try to recover from the error, it should be fine to leave it with the old value, but resetting it to NULL will make Coverity happy next time we run it. Found by Coverity.
Found by Coverity.
yaml_error() expects a variable of type char*. Found by Coverity.
When we jump to err_path, we destroy the parser and it might not be initialized yet.
They are discarded anyway. Found by Coverity.
Both GString will not be released if this function is called with an empty state. Found by Coverity.
The only test at the moment is related to a memory leak plugged in the function netplan_state_finish_nm_write() that happens when the state is empty. A couple of non-related functions were renamed so they will not collide with functions with the same name defined in another file.
Found by Coverity.
The only test at the moment check that write_ovs_bond_interfaces() returns NULL when netdef->bridge is NULL. It's also used to check if the function doesn't leak memory in this case. The function write_bridge_params() was renamed so the name will not conflict with another function defined in another file.
Release both parser and state before returning. Found by Coverity.
The storage allocated by g_strdup_printf() was being lost. Add a cmocka test for this case. Found by Coverity.
The variable "sequence" might not be released if we hit the assertion assert_type() after having allocated storage for the string. The same will happen if we reach the return in the if condition below assert_type. Found by Coverity.
It's possible that a file descriptor would leak if fdopen() failed for any reason. Found by Coverity.
Use g_autoptr() with GStrings link and network. Found by Coverity.
The variable options_kf_value would leak if a route_options key is found without a route in the keyfile, the loop is being interrupted before the variable is free'd. Add a test that causes the problem. Found by Coverity.
mkstemp from glibc will create a file with mode 600 by default. Although, mkstemp manpages suggests that umask must be set appropriately before calling mkstemp because the POSIX spec doesn't mention file modes. Found by Coverity.
Found by Coverity.
slyon
approved these changes
Jul 25, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All looking good, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses some issues found via static analysis by the Coverity tool.
FR-3484
Checklist
make check
successfully.make check-coverage
).