mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 22:46:15 +01:00
gvariant: Ensure GVS.depth is initialised
When byteswapping the depth was accidentally left uninitialised. Coverity CID: #1430636 Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
fb6da5677b
commit
a5d34a7c78
@ -666,6 +666,21 @@ g_variant_is_trusted (GVariant *value)
|
||||
return (value->state & STATE_TRUSTED) != 0;
|
||||
}
|
||||
|
||||
/* < internal >
|
||||
* g_variant_get_depth:
|
||||
* @value: a #GVariant
|
||||
*
|
||||
* Gets the nesting depth of a #GVariant. This is 0 for a #GVariant with no
|
||||
* children.
|
||||
*
|
||||
* Returns: nesting depth of @value
|
||||
*/
|
||||
gsize
|
||||
g_variant_get_depth (GVariant *value)
|
||||
{
|
||||
return value->depth;
|
||||
}
|
||||
|
||||
/* -- public -- */
|
||||
|
||||
/**
|
||||
|
@ -34,4 +34,6 @@ gboolean g_variant_is_trusted (GVarian
|
||||
|
||||
GVariantTypeInfo * g_variant_get_type_info (GVariant *value);
|
||||
|
||||
gsize g_variant_get_depth (GVariant *value);
|
||||
|
||||
#endif /* __G_VARIANT_CORE_H__ */
|
||||
|
@ -5952,6 +5952,7 @@ g_variant_byteswap (GVariant *value)
|
||||
serialised.type_info = g_variant_get_type_info (trusted);
|
||||
serialised.size = g_variant_get_size (trusted);
|
||||
serialised.data = g_malloc (serialised.size);
|
||||
serialised.depth = g_variant_get_depth (trusted);
|
||||
g_variant_store (trusted, serialised.data);
|
||||
g_variant_unref (trusted);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user