summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorW. Michael Petullo <mike@flyn.org>2023-03-18 12:03:54 -0500
committerVictor Toso <victortoso@gnome.org>2023-04-01 08:15:40 +0000
commit636025c30aeb3f222fa69aa50e53eb902ca39cf6 (patch)
tree81164f855fed1c366c2dc68beb4b8950f0002edd
parentd548f16e2d9941d41a2bff806a4990574c548062 (diff)
downloadgrilo-plugins-636025c30aeb3f222fa69aa50e53eb902ca39cf6.tar.gz
dmap: fix memory handling surrounding DPAP thumbnails
The reference counting of a DPAP record's thumbnail property was off. This commit makes proper use of g_(byte)_array_ref. Libdmapsharing's dmap-image-connection.c:_handle_mlcl() makes this necessary: it unrefs the thumbnail pointer after passing it to g_object_set(record, ...). Signed-off-by: W. Michael Petullo <mike@flyn.org>
-rw-r--r--src/dmap/grl-dpap-compat.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dmap/grl-dpap-compat.h b/src/dmap/grl-dpap-compat.h
index 212fab4..a146698 100644
--- a/src/dmap/grl-dpap-compat.h
+++ b/src/dmap/grl-dpap-compat.h
@@ -49,7 +49,7 @@ grl_dpap_record_factory_create_compat (DmapRecordFactory *factory, gpointer user
static inline void
set_thumbnail (GValue *value, GByteArray *thumbnail)
{
- g_value_set_pointer (value, thumbnail);
+ g_value_set_pointer (value, g_byte_array_ref (thumbnail));
}
static inline GByteArray *
@@ -82,7 +82,7 @@ guint grl_dpap_db_add (DmapDb *_db, DmapRecord *_record, GError **error);
static inline void
set_thumbnail (GValue *value, GArray *thumbnail)
{
- g_value_set_boxed (value, thumbnail);
+ g_value_set_boxed (value, g_array_ref (thumbnail));
}
static inline GArray *
@@ -90,7 +90,7 @@ get_thumbnail (GArray *thumbnail, const GValue *value)
{
if (thumbnail)
g_array_unref (thumbnail);
- return g_value_get_boxed (value);
+ return g_array_ref (g_value_get_boxed (value));
}
static inline void