Exemple #1
0
status_t
vmi_destroy(
    vmi_instance_t vmi)
{
    if (!vmi)
        return VMI_FAILURE;

    vmi->shutting_down = TRUE;
    if(vmi->init_mode & VMI_INIT_EVENTS){
        events_destroy(vmi);
    }
    driver_destroy(vmi);
    if (vmi->os_interface) {
        os_destroy(vmi);
    }
    if (vmi->os_data) {
        free(vmi->os_data);
    }
    if (vmi->arch_interface) {
        free(vmi->arch_interface);
    }
    vmi->os_data = NULL;
    pid_cache_destroy(vmi);
    sym_cache_destroy(vmi);
    rva_cache_destroy(vmi);
    v2p_cache_destroy(vmi);
#if ENABLE_SHM_SNAPSHOT == 1
    v2m_cache_destroy(vmi);
#endif
    memory_cache_destroy(vmi);
    if (vmi->image_type)
        free(vmi->image_type);
    free(vmi);
    return VMI_SUCCESS;
}
Exemple #2
0
void APE_destroy(ape_global *ape)
{
    //  destroying dns
    struct _ares_sockets *as;
    size_t i;

    ares_cancel(ape->dns.channel);
    as = ape->dns.sockets.list;

    for (i = 0; i < ape->dns.sockets.size; i++) {
        events_del(as->s.fd, ape);
        as++;
    }

    free(ape->dns.sockets.list);
    ape->dns.sockets.size = 0;
    ape->dns.sockets.used = 0;
    ares_destroy(ape->dns.channel);
    ares_library_cleanup();

    //  destroying events
    events_destroy(&ape->events);
    // destroying timers
    APE_timers_destroy_all(ape);

    if (ape->ssl_global_ctx) {
        ape_ssl_shutdown(ape->ssl_global_ctx);
        ape_ssl_destroy(ape->ssl_global_ctx);
    }
    ape_ssl_library_destroy();

    close(ape->urandom_fd);
    if (ape->logger.cleanup) {
        ape->logger.cleanup(ape->logger.ctx, ape->logger.cb_args);
    }
    //  destroying rest
    free(ape);

    pthread_setspecific(g_APEThreadContextKey, NULL);
}
Exemple #3
0
status_t
vmi_destroy(
    vmi_instance_t vmi)
{
    vmi->shutting_down = TRUE;
    if(vmi->init_mode & VMI_INIT_EVENTS){
        events_destroy(vmi);
    }
    driver_destroy(vmi);
    pid_cache_destroy(vmi);
    sym_cache_destroy(vmi);
    rva_cache_destroy(vmi);
    v2p_cache_destroy(vmi);
    memory_cache_destroy(vmi);
    if (vmi->sysmap)
        free(vmi->sysmap);
    if (vmi->image_type)
        free(vmi->image_type);
    if (vmi)
        free(vmi);
    return VMI_SUCCESS;
}