Illegal memory access when executing cufftExecD2Z in cuFFT library

I really appreciate it if anyone can help me with this.

https://stackoverflow.com/questions/65171227/illegal-memory-access-when-executing-cufftexecd2z

The code presented in the above question is inside a function that is called by the main function. Further, the same length cufftExecD2Z transform is also used in a different function but that didn’t throw any error.