summaryrefslogtreecommitdiff
path: root/src/analysis/db
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-05 22:03:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-05 22:03:38 (GMT)
commit17f591f2230ac66394467d5e5eefe71cb259637d (patch)
tree1664e994b2904e5e9009027fc57749a11667365b /src/analysis/db
parentff187d24b7441e88e1f0361d59b0f6f55851791f (diff)
Fixed a huge number of memory leaks.
Diffstat (limited to 'src/analysis/db')
-rw-r--r--src/analysis/db/collection-int.h1
-rw-r--r--src/analysis/db/collection.c2
-rw-r--r--src/analysis/db/items/comment.c10
3 files changed, 7 insertions, 6 deletions
diff --git a/src/analysis/db/collection-int.h b/src/analysis/db/collection-int.h
index cb0aea6..c2d1282 100644
--- a/src/analysis/db/collection-int.h
+++ b/src/analysis/db/collection-int.h
@@ -55,6 +55,7 @@ struct _GDbCollection
GType type; /* Identifiant GLib équivalent */
const char *name; /* Nom en base de données */
+ /* Référence circulaire */
GLoadedBinary *binary; /* Binaire rattaché éventuel */
GList *items; /* Eléments rassemblés */
diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c
index 0e4f756..9c28c4a 100644
--- a/src/analysis/db/collection.c
+++ b/src/analysis/db/collection.c
@@ -219,8 +219,6 @@ GDbCollection *g_db_collection_new(uint32_t id, GType type, const char *name)
void g_db_collection_link_to_binary(GDbCollection *collec, GLoadedBinary *binary)
{
- g_object_ref(G_OBJECT(binary));
-
collec->binary = binary;
}
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c
index b879d08..7eb7906 100644
--- a/src/analysis/db/items/comment.c
+++ b/src/analysis/db/items/comment.c
@@ -301,11 +301,10 @@ static void g_db_comment_dispose(GDbComment *comment)
{
size_t i; /* Boucle de parcours */
- for (i = 0; i < comment->old_count; i++)
- g_object_unref(G_OBJECT(comment->old_inlined[i]));
+ g_clear_object(&comment->previous);
- if (comment->old_inlined != NULL)
- free(comment->old_inlined);
+ for (i = 0; i < comment->old_count; i++)
+ g_clear_object(&comment->old_inlined[i]);
G_OBJECT_CLASS(g_db_comment_parent_class)->dispose(G_OBJECT(comment));
@@ -346,6 +345,9 @@ static void g_db_comment_finalize(GDbComment *comment)
unlock_flat_array(&comment->text);
+ if (comment->old_inlined != NULL)
+ free(comment->old_inlined);
+
G_OBJECT_CLASS(g_db_comment_parent_class)->finalize(G_OBJECT(comment));
}