summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/arm/context.c5
-rw-r--r--plugins/dwarf/format.c3
-rw-r--r--plugins/elf/format.c2
-rw-r--r--plugins/elf/loading.c2
-rw-r--r--plugins/elf/strings.c8
-rw-r--r--plugins/elf/symbols.c9
-rw-r--r--plugins/lnxsyscalls/hops_armv7.c5
-rw-r--r--plugins/pychrysalide/format/format.c3
-rw-r--r--plugins/readelf/strtab.c8
9 files changed, 41 insertions, 4 deletions
diff --git a/plugins/arm/context.c b/plugins/arm/context.c
index 6b62760..8f6ab52 100644
--- a/plugins/arm/context.c
+++ b/plugins/arm/context.c
@@ -140,6 +140,9 @@ static void g_arm_context_dispose(GArmContext *ctx)
static void g_arm_context_finalize(GArmContext *ctx)
{
+ if (ctx->areas != NULL)
+ free(ctx->areas);
+
G_OBJECT_CLASS(g_arm_context_parent_class)->finalize(G_OBJECT(ctx));
}
@@ -240,7 +243,7 @@ void _g_arm_context_define_encoding(GArmContext *ctx, virt_t addr, unsigned int
/* Sinon on redivise... */
else
{
- ctx->areas = (disass_arm_area *)realloc(ctx->areas, ++ctx->acount * sizeof(disass_arm_area));
+ ctx->areas = realloc(ctx->areas, ++ctx->acount * sizeof(disass_arm_area));
memmove(&ctx->areas[selected + 1], &ctx->areas[selected],
(ctx->acount - selected - 1) * sizeof(disass_arm_area));
diff --git a/plugins/dwarf/format.c b/plugins/dwarf/format.c
index 96ce831..e071f1c 100644
--- a/plugins/dwarf/format.c
+++ b/plugins/dwarf/format.c
@@ -216,8 +216,7 @@ GDbgFormat *g_dwarf_format_new(GExeFormat *parent)
result = g_object_new(G_TYPE_DWARF_FORMAT, NULL);
- G_DBG_FORMAT(result)->executable = parent;
- g_object_ref(G_OBJECT(parent));
+ g_debuggable_format_attach_executable(G_DBG_FORMAT(result), parent);
content = G_BIN_FORMAT(parent)->content;
diff --git a/plugins/elf/format.c b/plugins/elf/format.c
index d6bdc5e..08472e4 100644
--- a/plugins/elf/format.c
+++ b/plugins/elf/format.c
@@ -541,6 +541,8 @@ static bool g_elf_format_get_main_address(GElfFormat *format, vmpa2t *addr)
copy_vmpa(addr, get_mrange_addr(range));
+ g_object_unref(G_OBJECT(symbol));
+
}
return result;
diff --git a/plugins/elf/loading.c b/plugins/elf/loading.c
index eb992b9..73e75f0 100644
--- a/plugins/elf/loading.c
+++ b/plugins/elf/loading.c
@@ -496,6 +496,8 @@ static void g_elf_loading_process(GElfLoading *loading, GtkStatusStack *status)
{
ret = loading->callback_1(loading, format, symbol);
+ g_object_unref(G_OBJECT(symbol));
+
if (!ret)
{
log_variadic_message(LMT_ERROR, _("Error while applying ELF relocation %zu!"), processed);
diff --git a/plugins/elf/strings.c b/plugins/elf/strings.c
index f6be4a8..fe37a0d 100644
--- a/plugins/elf/strings.c
+++ b/plugins/elf/strings.c
@@ -345,6 +345,12 @@ static bool do_elf_string_loading(GElfLoading *loading, GElfFormat *format, phys
g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);
+ /**
+ * Comme g_preload_info_add_instruction() peut consommer l'instruction
+ * et qu'on réutilise cette dernière ensuite avec g_arch_instruction_get_range()...
+ */
+ g_object_ref(G_OBJECT(instr));
+
inserted = g_preload_info_add_instruction(base->info, instr);
result |= inserted;
@@ -373,6 +379,8 @@ static bool do_elf_string_loading(GElfLoading *loading, GElfFormat *format, phys
}
+ g_object_unref(G_OBJECT(instr));
+
/* Conclusion */
skip_first:
diff --git a/plugins/elf/symbols.c b/plugins/elf/symbols.c
index b6f05f6..5ddc99c 100644
--- a/plugins/elf/symbols.c
+++ b/plugins/elf/symbols.c
@@ -195,7 +195,10 @@ static void register_elf_entry_point(GElfFormat *format, virt_t vaddr, phys_t le
/* Comptabilisation en tant que symbole */
if (g_binary_format_find_symbol_at(G_BIN_FORMAT(format), &addr, &symbol))
+ {
+ g_object_unref(G_OBJECT(symbol));
g_object_unref(G_OBJECT(routine));
+ }
else
{
@@ -552,11 +555,13 @@ static bool do_elf_symbol_loading(GElfLoading *loading, GElfFormat *format, bool
{
g_binary_symbol_set_status(symbol, status);
+ /*
if (new != NULL)
{
g_object_ref(G_OBJECT(symbol));
*new = symbol;
}
+ */
g_binary_format_add_symbol(base, symbol);
@@ -749,6 +754,8 @@ static bool do_elf_global_symbol_loading(GElfLoading *loading, GElfFormat *forma
result = do_elf_symbol_loading(loading, format, false, iter, &symbol);
+ //g_clear_object(&symbol);
+
return result;
}
@@ -1048,7 +1055,7 @@ static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, el
{
result &= g_elf_loading_get_status(loadings[i]);
- g_object_ref(G_OBJECT(loadings[i]));
+ g_object_unref(G_OBJECT(loadings[i]));
}
diff --git a/plugins/lnxsyscalls/hops_armv7.c b/plugins/lnxsyscalls/hops_armv7.c
index d706a10..cde092c 100644
--- a/plugins/lnxsyscalls/hops_armv7.c
+++ b/plugins/lnxsyscalls/hops_armv7.c
@@ -148,11 +148,16 @@ static bool resolve_armv7_linux_syscall_number(tracked_path *exec, GArchProcesso
op = g_arch_instruction_get_operand(instr, 1);
if (!G_IS_IMM_OPERAND(op))
+ {
+ g_object_unref(G_OBJECT(op));
goto ralsn_exit;
+ }
*nr = g_imm_operand_get_raw_value(G_IMM_OPERAND(op));
result = true;
+ g_object_unref(G_OBJECT(op));
+
}
ralsn_exit:
diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c
index e285116..82cb575 100644
--- a/plugins/pychrysalide/format/format.c
+++ b/plugins/pychrysalide/format/format.c
@@ -243,7 +243,10 @@ static PyObject *py_binary_format_find_symbol_by_label(PyObject *self, PyObject
found = g_binary_format_find_symbol_by_label(format, PyUnicode_DATA(label), &symbol);
if (found)
+ {
result = pygobject_new(G_OBJECT(symbol));
+ g_object_unref(G_OBJECT(symbol));
+ }
else
{
result = Py_None;
diff --git a/plugins/readelf/strtab.c b/plugins/readelf/strtab.c
index 7645dec..277d391 100644
--- a/plugins/readelf/strtab.c
+++ b/plugins/readelf/strtab.c
@@ -106,6 +106,12 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);
+ /**
+ * Comme g_preload_info_add_instruction() peut consommer l'instruction
+ * et qu'on réutilise cette dernière ensuite avec g_arch_instruction_get_range()...
+ */
+ g_object_ref(G_OBJECT(instr));
+
inserted = g_preload_info_add_instruction(info, instr);
if (inserted)
@@ -127,6 +133,8 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
}
+ g_object_unref(G_OBJECT(instr));
+
/* Conclusion */
cut = (data[end - 1] == '\0');