Wrong cl_mem pointer causes segfault

Hi All!

I have a problem with my code and I can’t figure it out.
Here is the code: http://grid.kfki.hu/afs/szaqaei/web/hough.cpp

So the problem is when I try to write the memory segment pointed by buffer[0] it causes
“Segmentation fault (core dumped)” error. Everything else works fine, I checked everything
: the real array is not null, transfer smaller size of data … but keeps not working.
The error is in cl_TransferData().

I tried to detect the problem with valgrind but the program didn’t terminate.
Can somebody help me to find the error and suggest me a good debugger?

Thanks in advance,
Adam

I’ve found it in cl_calcDetVelo() I have to go till Num_Segments…