diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-11-03 14:01:38 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-11-03 14:01:38 (GMT) |
commit | e5d58e1f70405012fd8fbe8d61937f92fa3583a9 (patch) | |
tree | 29b555020a18df0e91ffd10460693bbe40bed729 /plugins | |
parent | 25576d8dd565547fe1178f7faa583a36718f98f8 (diff) |
Counted references for each provided binary format.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/androhelpers/androhelpers.c | 11 | ||||
-rw-r--r-- | plugins/androhelpers/params.c | 1 | ||||
-rw-r--r-- | plugins/androhelpers/switch.c | 1 | ||||
-rw-r--r-- | plugins/androhelpers/try_n_catch.c | 9 | ||||
-rw-r--r-- | plugins/libcsem/exit.c | 4 | ||||
-rw-r--r-- | plugins/pychrysa/analysis/binary.c | 2 | ||||
-rw-r--r-- | plugins/ropgadgets/select.c | 1 | ||||
-rw-r--r-- | plugins/stackvars/stackvars.c | 2 |
8 files changed, 20 insertions, 11 deletions
diff --git a/plugins/androhelpers/androhelpers.c b/plugins/androhelpers/androhelpers.c index 1ba9640..a95c925 100644 --- a/plugins/androhelpers/androhelpers.c +++ b/plugins/androhelpers/androhelpers.c @@ -95,11 +95,16 @@ PluginAction get_plugin_action(const GPluginModule *plugin) bool execute_action_on_binary(GPluginModule *plugin, GLoadedBinary *binary, PluginAction action) { bool result; /* Bilan à retourner */ + GExeFormat *format; /* Format associé au binaire */ - if (!G_IS_DEX_FORMAT(g_loaded_binary_get_format(binary))) - return false; + format = g_loaded_binary_get_format(binary); + + result = G_IS_DEX_FORMAT(format); - result = true; + g_object_unref(G_OBJECT(format)); + + if (!result) + return false; if (action == PGA_BINARY_DISASSEMBLED) result &= replace_parameters(binary); diff --git a/plugins/androhelpers/params.c b/plugins/androhelpers/params.c index ee580b6..c9b1109 100644 --- a/plugins/androhelpers/params.c +++ b/plugins/androhelpers/params.c @@ -218,6 +218,7 @@ bool replace_parameters(GLoadedBinary *binary) } g_object_unref(G_OBJECT(proc)); + g_object_unref(G_OBJECT(format)); return true; diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c index d976e56..43b6ae1 100644 --- a/plugins/androhelpers/switch.c +++ b/plugins/androhelpers/switch.c @@ -422,6 +422,7 @@ bool extract_switch_info(GLoadedBinary *binary, bool link) } g_object_unref(G_OBJECT(proc)); + g_object_unref(G_OBJECT(format)); return true; diff --git a/plugins/androhelpers/try_n_catch.c b/plugins/androhelpers/try_n_catch.c index 780fa59..28f7061 100644 --- a/plugins/androhelpers/try_n_catch.c +++ b/plugins/androhelpers/try_n_catch.c @@ -237,8 +237,8 @@ static void mark_exception_handlers(const GLoadedBinary *binary, uleb128_t size, static caught_exception **build_all_destinations_list(const GLoadedBinary *binary, const GBinRoutine *routine, const encoded_catch_handler_list *hlist, size_t **count) { caught_exception **result; /* Liste de listes à retourner */ - GDexFormat *format; /* Format du binaire chargé */ vmpa_t start; /* Début du code de la routine */ + GDexFormat *format; /* Format du binaire chargé */ GArchProcessor *proc; /* Processeur de l'architecture*/ GArchInstruction *instrs; /* Instructions Dalvik */ uleb128_t i; /* Boucle de parcours #1 */ @@ -248,10 +248,10 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar caught_exception *excep; /* Raccourci confortable */ GDataType *type; /* Type de l'exception */ - format = G_DEX_FORMAT(g_loaded_binary_get_format(binary)); - start = g_binary_routine_get_address(routine); + format = G_DEX_FORMAT(g_loaded_binary_get_format(binary)); + proc = g_loaded_binary_get_processor(binary); instrs = g_arch_processor_get_disassembled_instructions(proc); instrs = g_arch_instruction_find_by_address(instrs, start, true); @@ -312,6 +312,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar } g_object_unref(G_OBJECT(proc)); + g_object_unref(G_OBJECT(format)); return result; @@ -448,6 +449,8 @@ bool process_exception_handlers(GLoadedBinary *binary, bool link) } + g_object_unref(G_OBJECT(format)); + return true; } diff --git a/plugins/libcsem/exit.c b/plugins/libcsem/exit.c index 9db8286..b5545b9 100644 --- a/plugins/libcsem/exit.c +++ b/plugins/libcsem/exit.c @@ -88,9 +88,7 @@ static void mark_one_kind_of_exit_as_return(const GLoadedBinary *binary, const c mokoear_exit: - //g_object_unref(G_OBJECT(format)); - - ; + g_object_unref(G_OBJECT(format)); } diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c index b01d0b3..32e4a71 100644 --- a/plugins/pychrysa/analysis/binary.c +++ b/plugins/pychrysa/analysis/binary.c @@ -183,7 +183,7 @@ static PyObject *py_loaded_binary_get_format(PyObject *self, void *closure) result = pygobject_new(G_OBJECT(format)); - //g_object_unref(G_OBJECT(format)); + g_object_unref(G_OBJECT(format)); return result; diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index 8aa6021..8878839 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -1287,7 +1287,6 @@ static GBinFormat *load_internal_format_for_rop_gadgets(GObject *ref) push_status_printing_of_rop_search_step(ref, "format", _("already loaded"), true); - g_object_ref(G_OBJECT(result)); g_object_unref(G_OBJECT(binary)); return result; diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c index 49c831f..f4c43be 100644 --- a/plugins/stackvars/stackvars.c +++ b/plugins/stackvars/stackvars.c @@ -115,6 +115,8 @@ G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginActio for (i = 0; i < routines_count; i++) result |= replace_stack_vars_in_routine(routines[i], lines); + g_object_unref(G_OBJECT(format)); + return result; } |