Invalid Device Pointer

i’m getting an invalid device pointer on a cudaFree(x);

x is globally defined
it is cudaMalloc-ed in function 1(host)
it is used and then later cudaFree(x) in function 2(host)

whats the problem?

The immediate problem is that my crystal ball has gone foggy, and hence is unable to determine your GPU, OS, driver version, CUDA version or any of your code.