diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/content.c | 2 | ||||
-rw-r--r-- | src/analysis/contents/memory.c | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/analysis/content.c b/src/analysis/content.c index 626497e..7208f94 100644 --- a/src/analysis/content.c +++ b/src/analysis/content.c @@ -143,8 +143,6 @@ GBinContent *g_binary_content_get_root(GBinContent *content) result = iface->get_root(content); - g_object_ref(G_OBJECT(result)); - return result; } diff --git a/src/analysis/contents/memory.c b/src/analysis/contents/memory.c index e28d31c..0b14a48 100644 --- a/src/analysis/contents/memory.c +++ b/src/analysis/contents/memory.c @@ -192,6 +192,8 @@ static void g_memory_content_init(GMemoryContent *content) g_binary_content_set_attributes(G_BIN_CONTENT(content), empty); + g_object_unref(G_OBJECT(empty)); + content->data = NULL; content->length = 0; @@ -372,7 +374,10 @@ GBinContent *g_memory_content_new(const bin_t *data, phys_t size) static void g_memory_content_set_attributes(GMemoryContent *content, GContentAttributes *attribs) { + g_clear_object(&content->attribs); + content->attribs = attribs; + g_object_unref(G_OBJECT(attribs)); } @@ -395,6 +400,9 @@ static GContentAttributes *g_memory_content_get_attributes(const GMemoryContent result = content->attribs; + if (result != NULL) + g_object_ref(G_OBJECT(result)); + return result; } @@ -418,6 +426,8 @@ static GBinContent *g_memory_content_get_root(GMemoryContent *content) result = G_BIN_CONTENT(content); + g_object_ref(G_OBJECT(result)); + return result; } |