summaryrefslogtreecommitdiff
path: root/src/analysis/routine.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-03 11:24:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-03 11:24:26 (GMT)
commit4d179bc994cf85832d08f468c7e4122ad23e9244 (patch)
tree3348d3c001c961e9e464a644c12c9fc85e78d9b5 /src/analysis/routine.c
parent77735c8c77497498e3beb4f5bcec7de3b592fcbd (diff)
Updated the reference counters when providing instruction links.
Diffstat (limited to 'src/analysis/routine.c')
-rw-r--r--src/analysis/routine.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 1d03ad7..3b47930 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -1038,7 +1038,7 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
GArchInstruction *instr; /* Instruction correspondante */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
- instr_link_t *dest; /* Instr. visée par une autre */
+ const instr_link_t *dest; /* Instr. visée par une autre */
const mrange_t *irange; /* Emplacement d'instruction */
GLineCursor *cursor; /* Emplacement dans un tampon */
size_t index; /* Indice de ligne à traiter */
@@ -1102,12 +1102,12 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
call_count++;
if (call_count > max_calls)
- continue;
+ goto next_dest;
if (call_count == max_calls)
{
call_info = stradd(call_info, "\n ...");
- continue;
+ goto next_dest;
}
irange = g_arch_instruction_get_range(instr);
@@ -1150,20 +1150,20 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
case ILT_REF:
if (!G_IS_RAW_INSTRUCTION(dest->linked))
- continue;
+ goto next_dest;
if (!g_raw_instruction_is_string(G_RAW_INSTRUCTION(dest->linked)))
- continue;
+ goto next_dest;
string_count++;
if (string_count > max_strings)
- continue;
+ goto next_dest;
if (string_count == max_strings)
{
string_info = stradd(string_info, "\n ...");
- continue;
+ goto next_dest;
}
irange = g_arch_instruction_get_range(dest->linked);
@@ -1208,6 +1208,10 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi
}
+ next_dest:
+
+ unref_instr_link(dest);
+
}
g_arch_instruction_unlock_dest(instr);