Fix C code of GpuDownsampleFactorMaxGrad.

It was causing errors when running with cuda-memcheck, or when running
on Mac OS X.
It should fix the remaining issues described in gh-1172.