summaryrefslogtreecommitdiff
path: root/src/format/elf/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/elf/strings.c')
-rw-r--r--src/format/elf/strings.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/format/elf/strings.c b/src/format/elf/strings.c
index 53d4e92..e885632 100644
--- a/src/format/elf/strings.c
+++ b/src/format/elf/strings.c
@@ -159,6 +159,7 @@ static bool parse_elf_string_data(GElfFormat *format, phys_t start, phys_t size,
phys_t i; /* Boucle de parcours */
phys_t end; /* Position de fin de chaîne */
GArchInstruction *instr; /* Instruction décodée */
+ bool inserted; /* Bilan d'une insertion */
const mrange_t *range; /* Espace occupé par une chaîne*/
GBinSymbol *symbol; /* Symbole à intégrer */
char *label; /* Désignation de la chaîne */
@@ -203,22 +204,26 @@ static bool parse_elf_string_data(GElfFormat *format, phys_t start, phys_t size,
g_raw_instruction_mark_as_string(G_RAW_INSTRUCTION(instr), true);
- g_preload_info_add_instruction(base->info, instr);
+ inserted = g_preload_info_add_instruction(base->info, instr);
- range = g_arch_instruction_get_range(instr);
+ if (inserted)
+ {
+ range = g_arch_instruction_get_range(instr);
- symbol = g_binary_symbol_new(range, STP_RO_STRING);
- g_binary_format_add_symbol(base, symbol);
+ symbol = g_binary_symbol_new(range, STP_RO_STRING);
+ g_binary_format_add_symbol(base, symbol);
- /* Jointure avec la chaîne précédente ? */
+ /* Jointure avec la chaîne précédente ? */
- if (cut)
- {
- label = create_string_label(base, get_mrange_addr(range), end - i);
+ if (cut)
+ {
+ label = create_string_label(base, get_mrange_addr(range), end - i);
- g_binary_symbol_set_alt_label(symbol, label);
+ g_binary_symbol_set_alt_label(symbol, label);
- free(label);
+ free(label);
+
+ }
}