Commit 5b335f413 for llama.cpp
commit 5b335f413e4f73b0809c4fe39af894efbcc6a0d2
Author: Alexey Kopytko <alexey@kopytko.com>
Date: Fri Sep 18 22:58:25 2026 +0900
ggml : check for allocation failures to prevent crashes (#28149)
* ggml : check for allocation failures to prevent crashes
* wording
diff --git a/tools/mtmd/clip.cpp b/tools/mtmd/clip.cpp
index cd6421def..1783c7ddf 100644
--- a/tools/mtmd/clip.cpp
+++ b/tools/mtmd/clip.cpp
@@ -4436,7 +4436,10 @@ bool clip_encode(struct clip_ctx * ctx, struct clip_encode_params * params) {
// build the inference graph
ggml_backend_sched_reset(ctx->sched.get());
ggml_cgraph * gf = clip_get_graph_builder(ctx, imgs, params)->build();
- ggml_backend_sched_alloc_graph(ctx->sched.get(), gf);
+ if (!ggml_backend_sched_alloc_graph(ctx->sched.get(), gf)) {
+ LOG_ERR("%s: failed to allocate compute graph\n", __func__);
+ return false;
+ }
// set inputs
const auto & model = ctx->model;