library/src/memory/BP-LinuxMemMapping.cc
// Destroys a memory map given a debugging handle
Destroys a memory map given a debugging handle
Destroys a memory map given a debugging handle
int DestroyMemMap(P_DEBUG_HANDLE dbgHandle){
	if(dbgHandle == NULL)
		return ERR_DBG_HANDLE_NULL;
	if(dbgHandle->memory == NULL)
		return ERR_MEMMAP_NULL;
	if(dbgHandle->memory->next == NULL){
		return ERR_MEMMAP_NULL;
	}
	P_MEMORY_MAP next = dbgHandle->memory->next;
	for(dbgHandle->memory = dbgHandle->memory->first;
		dbgHandle->memory != NULL;
		dbgHandle->memory = next){
		next = dbgHandle->memory->next;
		if(dbgHandle->memory->path != NULL){
			bpfree(dbgHandle->memory->path);
		}
		bpfree(dbgHandle->memory);
		if(next == NULL){
			dbgHandle->memory = NULL;
			return ERR_SUCCESS;
		}
	}
	return ERR_SUCCESS;
}
int DestroyMemMap ( P_DEBUG_HANDLE dbgHandle ) { if ( dbgHandle == NULL ) return ERR_DBG_HANDLE_NULL ; if ( dbgHandle -> memory == NULL ) return ERR_MEMMAP_NULL ; if ( dbgHandle -> memory -> next == NULL ) { return ERR_MEMMAP_NULL ; } P_MEMORY_MAP next = dbgHandle -> memory -> next ; for ( dbgHandle -> memory = dbgHandle -> memory -> first ; dbgHandle -> memory != NULL ; dbgHandle -> memory = next ) { next = dbgHandle -> memory -> next ; if ( dbgHandle -> memory -> path != NULL ) { bpfree ( dbgHandle -> memory -> path ) ; } bpfree ( dbgHandle -> memory ) ; if ( next == NULL ) { dbgHandle -> memory = NULL ; return ERR_SUCCESS ; } } return ERR_SUCCESS ; }
Destroys a memory map given a debugging handle
Destroys a memory map given a debugging handle
// test handle // test memory // bpfree path if allocated // bpfree main structure