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/androhelpers | |
parent | 25576d8dd565547fe1178f7faa583a36718f98f8 (diff) |
Counted references for each provided binary format.
Diffstat (limited to 'plugins/androhelpers')
-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 |
4 files changed, 16 insertions, 6 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; } |