summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/processor.c8
-rw-r--r--src/common/array.c7
-rw-r--r--src/core/global.c2
-rw-r--r--src/format/format.c5
-rw-r--r--src/gui/editor.c2
-rw-r--r--src/main.c2
6 files changed, 18 insertions, 8 deletions
diff --git a/src/arch/processor.c b/src/arch/processor.c
index 4d7bacc..05e3206 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -187,6 +187,11 @@ static void g_arch_processor_init(GArchProcessor *proc)
static void g_arch_processor_dispose(GArchProcessor *proc)
{
+ size_t i; /* Boucle de parcours */
+
+ for (i = 0; i < proc->instr_count; i++)
+ g_clear_object(&proc->instructions[i]);
+
g_mutex_clear(&proc->mutex);
g_mutex_clear(&proc->error_mutex);
@@ -212,6 +217,9 @@ static void g_arch_processor_finalize(GArchProcessor *proc)
{
size_t i; /* Boucle de parcours */
+ if (proc->instructions != NULL)
+ free(proc->instructions);
+
if (proc->errors != NULL)
{
for (i = 0; i < proc->error_count; i++)
diff --git a/src/common/array.c b/src/common/array.c
index 8264101..3f721be 100644
--- a/src/common/array.c
+++ b/src/common/array.c
@@ -285,7 +285,7 @@ void copy_flat_array_items(flat_array_t **src, flat_array_t **dest, size_t size,
{
extended = EXTENDED_ARRAY(*src);
- new_ext = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ new_ext = malloc(sizeof(ext_flat_array_t));
new_ext->items = malloc(extended->count * size);
new_ext->count = extended->count;
@@ -387,7 +387,7 @@ void add_item_to_flat_array(flat_array_t **array, const void *item, size_t size)
{
if (FLAT_ARRAY_HAS_NO_INDEX(*array))
{
- extended = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ extended = malloc(sizeof(ext_flat_array_t));
extended->items = malloc(2 * size);
extended->count = 2;
@@ -456,7 +456,7 @@ void insert_item_into_flat_array(flat_array_t **array, void *item, size_t size,
{
if (FLAT_ARRAY_HAS_NO_INDEX(*array))
{
- extended = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ extended = malloc(sizeof(ext_flat_array_t));
extended->items = malloc(size);
extended->count = 1;
@@ -581,6 +581,7 @@ void rem_item_from_flat_array(flat_array_t **array, size_t index, size_t size)
else
memcpy(new, ((char *)extended->items) + size, size);
+ free(extended->items);
free(extended);
relock_flat_array(array, new);
diff --git a/src/core/global.c b/src/core/global.c
index 3777fd9..f61def6 100644
--- a/src/core/global.c
+++ b/src/core/global.c
@@ -283,8 +283,6 @@ GStudyProject *get_current_project(void)
void register_project_change_notification(current_project_change_cb notify)
{
- assert(_project_notify == NULL);
-
_project_notify = notify;
}
diff --git a/src/format/format.c b/src/format/format.c
index 261f152..cd71a21 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -156,10 +156,9 @@ static void g_binary_format_init(GBinFormat *format)
static void g_binary_format_dispose(GBinFormat *format)
{
- if (format->demangler != NULL)
- g_object_unref(format->demangler);
+ g_clear_object(&format->demangler);
- g_object_unref(format->info);
+ g_clear_object(&format->info);
g_rw_lock_clear(&format->syms_lock);
diff --git a/src/gui/editor.c b/src/gui/editor.c
index 205c78f..58dda53 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -408,6 +408,8 @@ static void on_destroy_editor(GtkWidget *widget, GObject *ref)
on_focus_out(widget, NULL, ref);
+ /* On évite de mettre à jour un affichage disparu... */
+ register_project_change_notification(NULL);
/* Si la boucle principale est bien lancée, on en sort ! */
if (gtk_main_level() > 0)
diff --git a/src/main.c b/src/main.c
index 34aea01..9ae3936 100644
--- a/src/main.c
+++ b/src/main.c
@@ -388,6 +388,8 @@ int main(int argc, char **argv)
else
gtk_main();
+ set_current_project(NULL);
+
bad_project:
if (server != NULL)