summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/content.c2
-rw-r--r--src/analysis/contents/memory.c10
-rw-r--r--src/main.c5
3 files changed, 12 insertions, 5 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;
}
diff --git a/src/main.c b/src/main.c
index 434c861..356e796 100644
--- a/src/main.c
+++ b/src/main.c
@@ -540,10 +540,9 @@ static int open_binaries(char **files, int count)
}
else
- {
- g_object_unref(G_OBJECT(attribs));
result = EXIT_FAILURE;
- }
+
+ g_object_unref(G_OBJECT(attribs));
}