-
Notifications
You must be signed in to change notification settings - Fork 309
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
2023.6 coverity minor fixes #3013
Conversation
Part of the continuation of unit testing coverage.
Coverity points out that since we're now *always* initializing metadata, the `create_empty_gvariant_dict()` is unreachable.
Spotted by coverity.
Coverity complains about this, even though they're the same thing.
@@ -415,17 +415,18 @@ ostree_sign_ed25519_add_pk (OstreeSign *self, GVariant *public_key, GError **err | |||
if (!_ostree_sign_ed25519_is_initialized (sign, error)) | |||
return FALSE; | |||
|
|||
gpointer key = NULL; | |||
g_autofree guint8 *key_owned = NULL; | |||
const guint8 *key = NULL; |
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.
Why not?
g_autofree const guint8 *key = NULL;
key_owned
is unused, just set.
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.
Because g_variant_get_fixed_array()
returns a const
pointer into its data, whereas g_base64_decode
returns a new value. Notice that we do set key_owned
only in the latter case.
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.
Ah I see, so you want it free'd at the end of scope in one case but not the other... Makes sense
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.
LGTM
switchroot: Lower config parser to otcore, add unit tests
Part of the continuation of unit testing coverage.
commit: Drop dead code
Coverity points out that since we're now always initializing
metadata, the
create_empty_gvariant_dict()
is unreachable.sign/ed25519: Fix two memory leaks
Spotted by coverity.
switchroot: Use g_new/g_free consistently
Coverity complains about this, even though they're the same thing.