Fix null pointer in bobj.c (#16015)

* fixing memory leaks
* use the return if macro
* removed redundand checks
* fixed some out of bound accesses
* fixed null pointer bug in bobj
This commit is contained in:
Marco Grassi 2020-02-21 18:05:55 +08:00 committed by GitHub
parent 213bfb622c
commit 05ee096280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -256,11 +256,13 @@ static void r_bin_object_rebuild_classes_ht(RBinObject *o) {
RBinClass *klass;
RBinSymbol *method;
r_list_foreach (o->classes, it, klass) {
ht_pp_insert (o->classes_ht, klass->name, klass);
if (klass->name) {
ht_pp_insert (o->classes_ht, klass->name, klass);
r_list_foreach (klass->methods, it2, method) {
const char *name = sdb_fmt ("%s::%s", klass->name, method->name);
ht_pp_insert (o->methods_ht, name, method);
r_list_foreach (klass->methods, it2, method) {
const char *name = sdb_fmt ("%s::%s", klass->name, method->name);
ht_pp_insert (o->methods_ht, name, method);
}
}
}
}