Detecting buffer allocation failure?

Is there any way to detect when allocating a GPU buffer has failed in NVIDIA OpenCL? I use the following code to allocate a large memory buffer:

devTestMem = clCreateBuffer(ctx,CL_MEM_READ_WRITE,megsToTest*1048576UL,NULL,&err);

if (err != CL_SUCCESS) {

	cerr << "Unable to allocate OpenCL memory: "<<descriptionOfError(err)<<endl;

	throw 1;

}

But clCreateBuffer appears to always return CL_SUCCESS (the error string is never output), even if I do something silly like request 2GB of memory on a 1 GB card. When a kernel is invoked on that memory, I get a segfault in clWaitForEvents waiting for kernel completion, so it’s not even an error I can trap.

On the ATI OpenCL implementation, I get CL_MEM_OBJECT_ALLOCATION_FAILURE when trying to allocate too much memory. How can I do something similar on the NVIDIA implementation? (Linux x86_64, drivers v256.35, OpenCL 1.0/CUDA 3.1.1, for what it’s worth)