edid: Ensure strings owned by MetaEdidInfo are freed
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3888>
This commit is contained in:
parent
a541aa9a8c
commit
31e027d1b1
5 changed files with 18 additions and 4 deletions
|
@ -595,7 +595,16 @@ meta_edid_info_new_parse (const uint8_t *edid,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_free (info);
|
||||
meta_edid_info_free (info);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_edid_info_free (MetaEdidInfo *info)
|
||||
{
|
||||
g_clear_pointer (&info->manufacturer_code, g_free);
|
||||
g_clear_pointer (&info->dsc_serial_number, g_free);
|
||||
g_clear_pointer (&info->dsc_product_name, g_free);
|
||||
g_free (info);
|
||||
}
|
||||
|
|
|
@ -96,3 +96,8 @@ struct _MetaEdidInfo
|
|||
META_EXPORT_TEST
|
||||
MetaEdidInfo *meta_edid_info_new_parse (const uint8_t *edid,
|
||||
size_t size);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_edid_info_free (MetaEdidInfo *info);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaEdidInfo, meta_edid_info_free)
|
||||
|
|
|
@ -111,7 +111,7 @@ meta_output_info_unref (MetaOutputInfo *output_info)
|
|||
g_free (output_info->product);
|
||||
g_free (output_info->serial);
|
||||
g_free (output_info->edid_checksum_md5);
|
||||
g_free (output_info->edid_info);
|
||||
g_clear_pointer (&output_info->edid_info, meta_edid_info_free);
|
||||
g_free (output_info->modes);
|
||||
g_free (output_info->possible_crtcs);
|
||||
g_free (output_info->possible_clones);
|
||||
|
|
|
@ -65,7 +65,7 @@ int
|
|||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
MetaEdidInfo *edid_info;
|
||||
g_autoptr (MetaEdidInfo) edid_info = NULL;
|
||||
edid_info = meta_edid_info_new_parse (edid_blob,edid_blob_len);
|
||||
|
||||
g_assert_nonnull (edid_info);
|
||||
|
|
|
@ -357,7 +357,7 @@ get_connector_description (MetaKmsConnector *kms_connector)
|
|||
{
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
gconstpointer edid_data;
|
||||
g_autofree MetaEdidInfo *edid_info = NULL;
|
||||
g_autoptr (MetaEdidInfo) edid_info = NULL;
|
||||
size_t edid_size;
|
||||
g_autofree char *vendor = NULL;
|
||||
g_autofree char *product = NULL;
|
||||
|
|
Loading…
Reference in a new issue