From 636025c30aeb3f222fa69aa50e53eb902ca39cf6 Mon Sep 17 00:00:00 2001 From: "W. Michael Petullo" Date: Sat, 18 Mar 2023 12:03:54 -0500 Subject: [PATCH] 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 --- src/dmap/grl-dpap-compat.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dmap/grl-dpap-compat.h b/src/dmap/grl-dpap-compat.h index 212fab45..a1466981 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 -- GitLab