Skip to content

ElfDeinit

Description

Release storage owned by an Elf. Frees the byte buffer through allocator and tears down the section / symbol vectors. All three ElfOpen* constructors leave the parser as the sole owner of data, so this is unconditional. Safe to call on a zeroed struct.

Usage example (Cross-references)

Usage examples (Cross-references)
        }
    
        ElfDeinit(&stripped);
        DefaultAllocatorDeinit(&alloc);
        return ok && sym_missing_or_unnamed;
        if (built)
            DwarfLinesDeinit(&lines);
        ElfDeinit(&elf);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        ElfDeinit(&elf);
        SymbolResolverDeinit(&res);
        DefaultAllocatorDeinit(&alloc);
        }
    
        ElfDeinit(&elf);
        SymbolResolverDeinit(&res);
        DefaultAllocatorDeinit(&alloc);
        }
    
        ElfDeinit(&elf);
        SymbolResolverDeinit(&res);
        DefaultAllocatorDeinit(&alloc);
        ok = ok && elf.symbols.length > 0;
    
        ElfDeinit(&elf);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        bool              ok   = text != NULL && text->size > 0 && (text->flags & 0x4); // SHF_EXECINSTR = 0x4
    
        ElfDeinit(&elf);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
        bool ok = elf.build_id != NULL && elf.build_id_size > 0 && elf.build_id_size <= 64;
        ElfDeinit(&elf);
        DefaultAllocatorDeinit(&alloc);
        return ok;
        }
    
        ElfDeinit(&elf);
        DefaultAllocatorDeinit(&alloc);
        return ok;
                    return true;
                }
                ElfDeinit(out);
            }
        }
                    return true;
                }
                ElfDeinit(out);
            }
                    return true;
                }
                ElfDeinit(out);
            }
                    return true;
                }
                ElfDeinit(out);
            }
            (void)cand_dirs; // unused list kept for future variants
        if (!VecPushBackR(&self->cache, entry)) {
            if (entry.has_sidecar)
                ElfDeinit(&entry.sidecar);
            ElfDeinit(&entry.elf);
            return NULL;
            if (entry.has_sidecar)
                ElfDeinit(&entry.sidecar);
            ElfDeinit(&entry.elf);
            return NULL;
        }
    #endif
            if (e->has_sidecar) {
                ElfDeinit(&e->sidecar);
            }
            ElfDeinit(&e->elf);
                ElfDeinit(&e->sidecar);
            }
            ElfDeinit(&e->elf);
        }
        VecDeinit(&self->cache);
    
    fail:
        ElfDeinit(out);
        return false;
    }
    }
    
    void ElfDeinit(Elf *self) {
        if (!self)
            return;
Last updated on