From da03e81474f8e5271c61cb88cb56bb1f9e2b3cfd Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 25 Oct 2021 00:05:04 +0200
Subject: Fix mistakes in reference counters for binary contents.

---
 src/analysis/content.c         | 10 ----------
 src/analysis/contents/memory.c |  2 +-
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/analysis/content.c b/src/analysis/content.c
index 7208f94..6d8075c 100644
--- a/src/analysis/content.c
+++ b/src/analysis/content.c
@@ -77,20 +77,12 @@ static void g_binary_content_default_init(GBinContentInterface *iface)
 
 void g_binary_content_set_attributes(GBinContent *content, GContentAttributes *attribs)
 {
-    GContentAttributes *old;                /* Ancien jeu d'attributs      */
     GBinContentIface *iface;                /* Interface utilisée          */
 
     iface = G_BIN_CONTENT_GET_IFACE(content);
 
-    old = iface->get_attribs(content);
-
-    if (old != NULL)
-        g_object_unref(G_OBJECT(old));
-
     iface->set_attribs(content, attribs);
 
-    g_object_ref_sink(G_OBJECT(attribs));
-
 }
 
 
@@ -115,8 +107,6 @@ GContentAttributes *g_binary_content_get_attributes(const GBinContent *content)
 
     result = iface->get_attribs(content);
 
-    g_object_ref(G_OBJECT(result));
-
     return result;
 
 }
diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c
index 0b14a48..9ddc4fa 100644
--- a/src/analysis/contents/memory.c
+++ b/src/analysis/contents/memory.c
@@ -377,7 +377,7 @@ static void g_memory_content_set_attributes(GMemoryContent *content, GContentAtt
     g_clear_object(&content->attribs);
 
     content->attribs = attribs;
-    g_object_unref(G_OBJECT(attribs));
+    g_object_ref(G_OBJECT(attribs));
 
 }
 
-- 
cgit v0.11.2-87-g4458