Execution Error - clGetProgramInfo with CL_PROGRAM_BINARIES

Hi,
I tried get the binnary of my kernel, but when i run the code below a execution error occours in the line: errcode = clGetProgramInfo(program, CL_PROGRAM_BINARIES, binary_sizes[0]*sizeof(size_t), binary,&quantidadecopiadaparamvalue);

//Compilação do Kernel.
cl_int erro_compila_kernel = clBuildProgram(program, 1, &device, header_opcao, NULL, NULL);

//**************
size_t number_of_binaries;
size_t quantidadecopiadaparamvalue;
cl_uint num_dispositivos;
int errcode = clGetProgramInfo(program, CL_PROGRAM_NUM_DEVICES, sizeof(cl_uint), &num_dispositivos, NULL);


if( errcode == CL_SUCCESS )
	cout << "

A quantidade de dispositivos é: " << num_dispositivos;
else
cout << "
Não foi possível retornar a quantidade de dispositivos.";

size_t *binary_sizes = (size_t *) malloc(num_dispositivos * sizeof(size_t));


errcode = clGetProgramInfo(program, CL_PROGRAM_BINARY_SIZES,num_dispositivos *  sizeof(size_t), binary_sizes, NULL);

if( errcode == CL_SUCCESS )
	cout &lt;&lt; "

A quantidade de Bytes é: " << binary_sizes[0];
else
cout << "
Não retornou a quantidade de bytes.";

char **binary = (char **) malloc(num_dispositivos * sizeof(char*));
for(int i = 0; i &lt; num_dispositivos; i++ )
{
	binary[i] = (char *) malloc(binary_sizes[i] * sizeof(char));
}


errcode = clGetProgramInfo(program, CL_PROGRAM_BINARIES, binary_sizes[0]*sizeof(size_t), binary,&quantidadecopiadaparamvalue); //Here is where the error occurs

Very thanks,

Hi,

No one knows?
I really need to solve that.
I know that is boring analyse code, but if someone can help, i will be grateful a lot.