MCPcopy Create free account
hub / github.com/capstone-engine/capstone / cs_close

Function cs_close

cs.c:514–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512
513CAPSTONE_EXPORT
514cs_err CAPSTONE_API cs_close(csh *handle)
515{
516 struct cs_struct *ud;
517 struct insn_mnem *next, *tmp;
518
519 if (*handle == 0)
520 // invalid handle
521 return CS_ERR_CSH;
522
523 ud = (struct cs_struct *)(*handle);
524
525 if (ud->printer_info)
526 cs_mem_free(ud->printer_info);
527
528 // free the linked list of customized mnemonic
529 tmp = ud->mnem_list;
530 while(tmp) {
531 next = tmp->next;
532 cs_mem_free(tmp);
533 tmp = next;
534 }
535
536 cs_mem_free(ud->insn_cache);
537 cs_mem_free(ud->x86_insn_lut);
538 cs_mem_free(ud->x86_insn_reg_lut);
539
540 memset(ud, 0, sizeof(*ud));
541 cs_mem_free(ud);
542
543 // invalidate this handle by ZERO out its value.
544 // this is to make sure it is unusable after cs_close()
545 *handle = 0;
546
547 return CS_ERR_OK;
548}
549
550// replace str1 in target with str2; target starts with str1
551// output is put into result (which is array of char with size CS_MNEMONIC_SIZE)

Callers 15

mainFunction · 0.85
testFunction · 0.85
teardown_MCFunction · 0.85
teardown_issueFunction · 0.85
test_invalidsFunction · 0.85
test_validsFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
mainFunction · 0.85
cs_driver_helloFunction · 0.85
bs_closeFunction · 0.85
ocaml_closeFunction · 0.85

Calls

no outgoing calls

Tested by 15

mainFunction · 0.68
testFunction · 0.68
test_invalidsFunction · 0.68
test_validsFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68
testFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…