mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-15 02:45:36 +00:00
trivial: Fix a few theoretical memory leaks that can't happen in reality
PVS: The function was exited without releasing the 'str' pointer.
This commit is contained in:
parent
e84e8b6927
commit
aa71485cc5
@ -204,7 +204,7 @@ fu_security_attrs_calculate_hsi(FuSecurityAttrs *self, FuSecurityAttrsFlags flag
|
|||||||
{
|
{
|
||||||
guint hsi_number = 0;
|
guint hsi_number = 0;
|
||||||
FwupdSecurityAttrFlags attr_flags = FWUPD_SECURITY_ATTR_FLAG_NONE;
|
FwupdSecurityAttrFlags attr_flags = FWUPD_SECURITY_ATTR_FLAG_NONE;
|
||||||
GString *str = g_string_new("HSI:");
|
g_autoptr(GString) str = g_string_new("HSI:");
|
||||||
const FwupdSecurityAttrFlags hpi_suffixes[] = {
|
const FwupdSecurityAttrFlags hpi_suffixes[] = {
|
||||||
FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE,
|
FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE,
|
||||||
FWUPD_SECURITY_ATTR_FLAG_NONE,
|
FWUPD_SECURITY_ATTR_FLAG_NONE,
|
||||||
@ -247,10 +247,8 @@ fu_security_attrs_calculate_hsi(FuSecurityAttrs *self, FuSecurityAttrsFlags flag
|
|||||||
if (fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE) &&
|
if (fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_RUNTIME_ISSUE) &&
|
||||||
fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_SUCCESS))
|
fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_SUCCESS))
|
||||||
continue;
|
continue;
|
||||||
if (fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA)) {
|
if (fwupd_security_attr_has_flag(attr, FWUPD_SECURITY_ATTR_FLAG_MISSING_DATA))
|
||||||
g_string_append(str, "INVALID:missing-data");
|
return g_strdup("HSI:INVALID:missing-data");
|
||||||
return g_string_free(str, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
attr_flags |= fwupd_security_attr_get_flags(attr);
|
attr_flags |= fwupd_security_attr_get_flags(attr);
|
||||||
}
|
}
|
||||||
@ -273,7 +271,7 @@ fu_security_attrs_calculate_hsi(FuSecurityAttrs *self, FuSecurityAttrsFlags flag
|
|||||||
FWUPD_MICRO_VERSION);
|
FWUPD_MICRO_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free(str, FALSE);
|
return g_string_free(g_steal_pointer(&str), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
static gchar *
|
static gchar *
|
||||||
fu_logitech_hidpp_msg_to_string(FuLogitechHidPpHidppMsg *msg)
|
fu_logitech_hidpp_msg_to_string(FuLogitechHidPpHidppMsg *msg)
|
||||||
{
|
{
|
||||||
GString *str = g_string_new(NULL);
|
|
||||||
const gchar *tmp;
|
const gchar *tmp;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
g_autoptr(GString) flags_str = g_string_new(NULL);
|
g_autoptr(GString) flags_str = g_string_new(NULL);
|
||||||
|
g_autoptr(GString) str = g_string_new(NULL);
|
||||||
|
|
||||||
g_return_val_if_fail(msg != NULL, NULL);
|
g_return_val_if_fail(msg != NULL, NULL);
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ fu_logitech_hidpp_msg_to_string(FuLogitechHidPpHidppMsg *msg)
|
|||||||
if (!fu_logitech_hidpp_msg_is_error(msg, &error)) {
|
if (!fu_logitech_hidpp_msg_is_error(msg, &error)) {
|
||||||
g_string_append_printf(str, "error: %s\n", error->message);
|
g_string_append_printf(str, "error: %s\n", error->message);
|
||||||
}
|
}
|
||||||
return g_string_free(str, FALSE);
|
return g_string_free(g_steal_pointer(&str), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -1862,9 +1862,9 @@ fu_util_release_to_string(FwupdRelease *rel, guint idt)
|
|||||||
const gchar *tmp2;
|
const gchar *tmp2;
|
||||||
GPtrArray *issues = fwupd_release_get_issues(rel);
|
GPtrArray *issues = fwupd_release_get_issues(rel);
|
||||||
GPtrArray *tags = fwupd_release_get_tags(rel);
|
GPtrArray *tags = fwupd_release_get_tags(rel);
|
||||||
GString *str = g_string_new(NULL);
|
|
||||||
guint64 flags = fwupd_release_get_flags(rel);
|
guint64 flags = fwupd_release_get_flags(rel);
|
||||||
g_autofree gchar *desc_fb = NULL;
|
g_autofree gchar *desc_fb = NULL;
|
||||||
|
g_autoptr(GString) str = g_string_new(NULL);
|
||||||
|
|
||||||
g_return_val_if_fail(FWUPD_IS_RELEASE(rel), NULL);
|
g_return_val_if_fail(FWUPD_IS_RELEASE(rel), NULL);
|
||||||
|
|
||||||
@ -2022,17 +2022,17 @@ fu_util_release_to_string(FwupdRelease *rel, guint idt)
|
|||||||
tag_strs);
|
tag_strs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free(str, FALSE);
|
return g_string_free(g_steal_pointer(&str), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
fu_util_remote_to_string(FwupdRemote *remote, guint idt)
|
fu_util_remote_to_string(FwupdRemote *remote, guint idt)
|
||||||
{
|
{
|
||||||
GString *str = g_string_new(NULL);
|
|
||||||
FwupdRemoteKind kind = fwupd_remote_get_kind(remote);
|
FwupdRemoteKind kind = fwupd_remote_get_kind(remote);
|
||||||
FwupdKeyringKind keyring_kind = fwupd_remote_get_keyring_kind(remote);
|
FwupdKeyringKind keyring_kind = fwupd_remote_get_keyring_kind(remote);
|
||||||
const gchar *tmp;
|
const gchar *tmp;
|
||||||
gint priority;
|
gint priority;
|
||||||
|
g_autoptr(GString) str = g_string_new(NULL);
|
||||||
|
|
||||||
g_return_val_if_fail(FWUPD_IS_REMOTE(remote), NULL);
|
g_return_val_if_fail(FWUPD_IS_REMOTE(remote), NULL);
|
||||||
|
|
||||||
@ -2149,7 +2149,7 @@ fu_util_remote_to_string(FwupdRemote *remote, guint idt)
|
|||||||
fwupd_remote_get_automatic_reports(remote) ? "true" : "false");
|
fwupd_remote_get_automatic_reports(remote) ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free(str, FALSE);
|
return g_string_free(g_steal_pointer(&str), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user