summaryrefslogtreecommitdiff
path: root/src/analysis/disass/dragon.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/disass/dragon.c
parent77735c8c77497498e3beb4f5bcec7de3b592fcbd (diff)
Updated the reference counters when providing instruction links.
Diffstat (limited to 'src/analysis/disass/dragon.c')
-rw-r--r--src/analysis/disass/dragon.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/analysis/disass/dragon.c b/src/analysis/disass/dragon.c
index 44d82da..04f5190 100644
--- a/src/analysis/disass/dragon.c
+++ b/src/analysis/disass/dragon.c
@@ -104,10 +104,10 @@ static dragon_node *create_dragon_nodes(GArchProcessor *proc, const instr_covera
size_t scount; /* Nombre de liens de source */
bool cut; /* Un découpage a été réalisé ?*/
size_t i; /* Boucle de parcours */
- instr_link_t *source; /* Instruction de source liée */
+ const instr_link_t *source; /* Instruction de source liée */
dragon_node *new; /* Nouvel élément à créer */
size_t dcount; /* Nombre de liens de dest. */
- instr_link_t *dest; /* Instruction de destination */
+ const instr_link_t *dest; /* Instruction de destination */
result = NULL;
*count = 0;
@@ -204,6 +204,8 @@ static dragon_node *create_dragon_nodes(GArchProcessor *proc, const instr_covera
}
+ unref_instr_link(source);
+
}
g_arch_instruction_unlock_src(instr);
@@ -238,6 +240,8 @@ static dragon_node *create_dragon_nodes(GArchProcessor *proc, const instr_covera
}
+ unref_instr_link(dest);
+
}
g_arch_instruction_unlock_dest(instr);
@@ -448,7 +452,7 @@ void compute_all_paths(dragon_node *nodes, size_t count)
{
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
- instr_link_t *dest; /* Instructions de destination */
+ const instr_link_t *dest; /* Instructions de destination */
dragon_node *next; /* Noeud suivant dans le code */
size_t id; /* Indice du bit associé */
@@ -483,6 +487,8 @@ void compute_all_paths(dragon_node *nodes, size_t count)
}
+ unref_instr_link(dest);
+
}
g_arch_instruction_unlock_dest(node->last);
@@ -535,7 +541,7 @@ void compute_all_dominators(dragon_node *nodes, size_t count)
dragon_node *predecessor; /* Noeud prédécesseur direct */
size_t scount; /* Nombre de liens de source */
size_t i; /* Boucle de parcours #2 */
- instr_link_t *source; /* Instruction d'origine */
+ const instr_link_t *source; /* Instruction d'origine */
inter = create_bit_field(count, false);
@@ -575,9 +581,9 @@ void compute_all_dominators(dragon_node *nodes, size_t count)
*/
- if (predecessor == NULL) break;
+ if (predecessor != NULL)
+ and_bit_field(inter, predecessor->bits);
- and_bit_field(inter, predecessor->bits);
break;
default:
@@ -585,6 +591,8 @@ void compute_all_dominators(dragon_node *nodes, size_t count)
}
+ unref_instr_link(source);
+
}
g_arch_instruction_unlock_src(node->first);