Access violation reading location

I just would know why i get 0xC0000005 Access Violation reading location when calling clCreateBuffer in this code


host_adjacency		= (cl_int*)		calloc( edges_no * 2, sizeof(cl_int) );

/* Other code */

adjacency	= clCreateBuffer( context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR | CL_MEM_COPY_HOST_PTR, edges_no * 2 * sizeof(cl_int),  host_adjacency, &cl_errcode );

while everything seems OK with this


host_adjacency		= (cl_int*)		calloc( edges_no * 2, sizeof(cl_int) );

/* Other code */

adjacency = clCreateBuffer( context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,	edges_no * 2 * sizeof(cl_int), NULL, &cl_errcode );
cl_errcode = clEnqueueWriteBuffer( com_queue, adjacency, CL_TRUE, 0, edges_no * 2 * sizeof(cl_int), (void*)host_adjacency, 0, NULL, NULL );

thanks