MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / xh_core_clear

Function xh_core_clear

Bcore/src/main/cpp/xhook/xh_core.c:583–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583void xh_core_clear()
584{
585 //stop the async refresh thread
586 if(xh_core_async_init_ok)
587 {
588 pthread_mutex_lock(&xh_core_mutex);
589 xh_core_refresh_thread_running = 0;
590 pthread_cond_signal(&xh_core_cond);
591 pthread_mutex_unlock(&xh_core_mutex);
592
593 pthread_join(xh_core_refresh_thread_tid, NULL);
594 xh_core_async_init_ok = 0;
595 }
596 xh_core_async_inited = 0;
597
598 //unregister the sig handler
599 if(xh_core_init_ok)
600 {
601 xh_core_del_sigsegv_handler();
602 xh_core_init_ok = 0;
603 }
604 xh_core_inited = 0;
605
606 pthread_mutex_lock(&xh_core_mutex);
607 pthread_mutex_lock(&xh_core_refresh_mutex);
608
609 //free all map info
610 xh_core_map_info_t *mi, *mi_tmp;
611 RB_FOREACH_SAFE(mi, xh_core_map_info_tree, &xh_core_map_info, mi_tmp)
612 {
613 RB_REMOVE(xh_core_map_info_tree, &xh_core_map_info, mi);
614 if(mi->pathname) free(mi->pathname);
615 free(mi);
616 }
617
618 //free all hook info
619 xh_core_hook_info_t *hi, *hi_tmp;
620 TAILQ_FOREACH_SAFE(hi, &xh_core_hook_info, link, hi_tmp)
621 {
622 TAILQ_REMOVE(&xh_core_hook_info, hi, link);
623#if XH_CORE_DEBUG
624 free(hi->pathname_regex_str);
625#endif
626 regfree(&(hi->pathname_regex));
627 free(hi->symbol);
628 free(hi);
629 }
630
631 //free all ignore info
632 xh_core_ignore_info_t *ii, *ii_tmp;
633 TAILQ_FOREACH_SAFE(ii, &xh_core_ignore_info, link, ii_tmp)
634 {
635 TAILQ_REMOVE(&xh_core_ignore_info, ii, link);
636#if XH_CORE_DEBUG
637 free(ii->pathname_regex_str);
638#endif
639 regfree(&(ii->pathname_regex));
640 free(ii->symbol);

Callers 1

xhook_clearFunction · 0.85

Calls 1

Tested by

no test coverage detected