library/src/decoders/x86ASM/BP-x86InstDecode.cc
// Destroys an instruction list, bpfreeing all subcomponents
Destroys an instruction list, bpfreeing all subcomponents
Destroys an instruction list bpfreeing all subcomponents
int X86_32_DestroyInstructionList(P_X86_32_DECODED_INSTRUCTION_LIST destroyList){
	if(destroyList == NULL)
		return ERR_FAILURE;
	if(destroyList->first == NULL)
		return ERR_FAILURE;
	P_X86_32_DECODED_INSTRUCTION_LIST nextList = NULL;
	unsigned char x = 0;
	for(destroyList = destroyList->first;
		destroyList != NULL; ){
		nextList = destroyList->next;
		if(destroyList->regStr != NULL){
			bpfree(destroyList->regStr);
			destroyList->regStr = NULL;
		}
		if(destroyList->rmStr != NULL){
			bpfree(destroyList->rmStr);
			destroyList->rmStr = NULL;
		}
		if(destroyList->intelDecode != NULL){
			bpfree(destroyList->intelDecode);
			destroyList->intelDecode = NULL;
		}
		for(x = 0; x < destroyList->prefixCount; x++){
			if(destroyList->prefixes[x].prefixStr != NULL)
				bpfree(destroyList->prefixes[x].prefixStr);
		}
		bpfree(destroyList);
		if(destroyList != NULL)
			destroyList = nextList;
		else
			break;
	}
	return ERR_SUCCESS;
}
int X86_32_DestroyInstructionList ( P_X86_32_DECODED_INSTRUCTION_LIST destroyList ) { if ( destroyList == NULL ) return ERR_FAILURE ; if ( destroyList -> first == NULL ) return ERR_FAILURE ; P_X86_32_DECODED_INSTRUCTION_LIST nextList = NULL ; unsigned char x = 0 ; for ( destroyList = destroyList -> first ; destroyList != NULL ; ) { nextList = destroyList -> next ; if ( destroyList -> regStr != NULL ) { bpfree ( destroyList -> regStr ) ; destroyList -> regStr = NULL ; } if ( destroyList -> rmStr != NULL ) { bpfree ( destroyList -> rmStr ) ; destroyList -> rmStr = NULL ; } if ( destroyList -> intelDecode != NULL ) { bpfree ( destroyList -> intelDecode ) ; destroyList -> intelDecode = NULL ; } for ( x = 0 ; x < destroyList -> prefixCount ; x ++ ) { if ( destroyList -> prefixes [ x ] . prefixStr != NULL ) bpfree ( destroyList -> prefixes [ x ] . prefixStr ) ; } bpfree ( destroyList ) ; if ( destroyList != NULL ) destroyList = nextList ; else break ; } return ERR_SUCCESS ; }
Destroys an instruction list, bpfreeing all subcomponents
Destroys an instruction list bpfreeing all subcomponents
// Argument checks // Counts prefixes // Loop through the list and bpfree elements // Set next // Destroy decoded modrm REG string (INTEL) // Destroy decoded rm REG string (INTEL) // Destroy decoded instruction string (INTEL) // Go through prefix array and destroy strings if // found. // Check if next is null, if it is, exit the loop.