diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-10-14 06:47:29 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-10-14 06:47:29 (GMT) |
commit | 810bce688d9b0e271d86886e182b62aa7166319f (patch) | |
tree | 33f9e4751616784fa1f97ea152f063d00c8509b6 /src/analysis/contents | |
parent | d405d93f41f9376c55ac8af7acde62eec80386ec (diff) |
Improve some reference counters inside binary contents.
Diffstat (limited to 'src/analysis/contents')
-rw-r--r-- | src/analysis/contents/memory.c | 10 |
1 files changed, 10 insertions, 0 deletions
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; } |