OpenCL crash on low memory

I’m testing my program that uses OpenCL in low memory conditions running it under ulimit, like:

make myprog && bash -c ‘ulimit -v 370000; ./myprog’

Everything works well, OpenCL kernel compilation can’t be done and reports CL_BUILD_PROGRAM_FAILURE, but when I try to get build log it just crashes. Here is excerpt from GDB:

#0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:31

#1  0x00007fb1501c7ea3 in ?? () from /usr/lib/libcuda.so

#2  0x00000000005e5264 in clGetProgramBuildInfo (program=0x2b840e0, 

	device=0x28dcb00, param_name=4483, param_value_size=0, param_value=0x0, 

	param_value_size_ret=0x7fb13fff9388)

	at .../OpenCL/cl_defs.inc:2162

...

It seems there are missing some checks for memory allocation errors.

My system is Debian sid/amd64 on Dell Latitude E6400 (Core2 Duo P6500, 4GB RAM, Quadro NVS 160M), video driver 256.35