diff --git a/src/model.cpp b/src/model.cpp index 8351a2be6..f7fb7fa22 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -995,6 +995,12 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, int n_thread continue; } + if (dst_tensor->data == nullptr) { + LOG_ERROR("memory allocation failed '%s'", tensor_storage.name.c_str()); + failed = true; + break; + } + // skip mmapped tensors if (dst_tensor->buffer != nullptr && dst_tensor->buffer == fdata.mmbuffer.get()) { continue;