more graceful handling of out-of-memory errors

* raise an error instead of dereferencing a NULL pointer on deep
userdata creation and lane struct creation