fix leaks 32bit
This commit is contained in:
parent
7983e97be3
commit
6c42540095
11
src/nm32.c
11
src/nm32.c
|
@ -134,6 +134,7 @@ char *get_sym_char32(Elf32_Sym sym, Elf32_Shdr sec, int *tool) {
|
|||
}
|
||||
return ("n");
|
||||
}
|
||||
|
||||
int nm32(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_ordering ordering) {
|
||||
t_root *tree = NULL;
|
||||
t_entry *entry = (t_entry *)malloc(sizeof(t_entry));
|
||||
|
@ -182,6 +183,8 @@ int nm32(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_orderin
|
|||
else {
|
||||
str = sec_str;
|
||||
}
|
||||
if (str != sec_str)
|
||||
free(sec_str);
|
||||
// ici la str (le symbole) est bon, on la charge dans le truc, ensuite on genere la vrai string a afficher, avant de sort
|
||||
entry->symbol = ft_strdup(str);
|
||||
free(str);
|
||||
|
@ -194,7 +197,7 @@ int nm32(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_orderin
|
|||
// ici le sym char a ete calculer, a partir de la on determine la verbosity
|
||||
// ici on fait if entry->verbosity >= verbosity, si c'est pas bon on skip toute la suite
|
||||
entry->verbosity = DEFAULT_VERBOSITY;
|
||||
if ((sym_char[0] == 'a' && sym.st_info == 4) || sym_char[0] == 'N' || tool == 1)// || entry->symbol[0] == '.')
|
||||
if ((sym_char[0] == 'a' && sym.st_info == 4) || sym_char[0] == 'N' || tool == 1)
|
||||
entry->verbosity = ALL;
|
||||
if (sym_char[0] == 'u' || sym_char[0] == 'v' || sym_char[0] == 'w' || (sym_char[0] >= 'A' && sym_char[0] <= 'Z' && sym_char[0] != 'N'))
|
||||
entry->verbosity = GLOBAL;
|
||||
|
@ -242,12 +245,18 @@ int nm32(t_mapped_file mapped_file, char *path, t_verbosity verbosity, t_orderin
|
|||
break;
|
||||
}
|
||||
fflush(stdout);
|
||||
} else {
|
||||
free(entry->symbol);
|
||||
free(sym_char);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free(entry);
|
||||
// ici on affiche tout ou no symbols en cas de list vide
|
||||
if (tree) {
|
||||
ft_putrbt(tree, &put_entry);
|
||||
ft_delrbt(tree, &free_entry);
|
||||
} else {
|
||||
ft_printf("sss", "nm: ", path, ": no symbols\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue