clCreateProgramWithBinary returns CL_OUT_OF_HOST_MEMORY

I had this problem: when I wanted to build program from binary, clCreateProgramBinary returned error -6: CL_OUT_OF_HOST_MEMORY . I searched internet for the problem and didn’t found solution. I decided to write the solution here for the case that you have same or similar problem. The code bellow was based on some code copied from somewhere.

built = clCreateProgramWithBinary( context, 1, &deviceID, (const size_t *)&kernelBinarySize, (const unsigned char **)&program, NULL, &err );

as you can see binary_status is NULL. There was some problem inside the function because program couldn’t set the referenced variable &binary_status. I found the solution here:
http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/online-offline-compilation/

built = clCreateProgramWithBinary( context, 1, &deviceID, (const size_t *)&kernelBinarySize, (const unsigned char **)&program, &binary_status, &err );

Now program successfully compiled.