I want to write a AES program, but it always return error 77 When I use the cudaFree function in the main function. I don’t know the reason and what should I do to debug it?
-------------------code--------------------------
uint4 * cipher_data_host, * cipher_data_device;
KEY_T * cipher_key_host, * cipher_key_device;
CUDA_CALL(cudaMallocHost(&cipher_data_host, (sizeof(uint4) * NUM_CIPHER_BLOCKS)));
CUDA_CALL(cudaMallocHost(&cipher_key_host, (sizeof(KEY_T) * 11)));
CUDA_CALL(cudaMalloc(&cipher_data_device, (sizeof(uint4) * NUM_CIPHER_BLOCKS)));
CUDA_CALL(cudaMalloc(&cipher_key_device, (sizeof(KEY_T) * 11)));
…
CUDA_CALL(cudaMemcpy(cipher_data_device, cipher_data_host, (sizeof(uint4) * NUM_CIPHER_BLOCKS),cudaMemcpyHostToDevice));
CUDA_CALL(cudaMemcpy(cipher_key_device, cipher_key_host, (sizeof(KEY_T) * 11), cudaMemcpyHostToDevice));
…
CUDA_CALL(cudaFree(cipher_data_device)); //returnning error 77 and creating a breakpoint
CUDA_CALL(cudaFree(cipher_key_device));
CUDA_CALL(cudaFreeHost(cipher_data_host));
CUDA_CALL(cudaFreeHost(cipher_key_host));