ggml : fix possible buffer use after free in sched reserve (#9930)

This commit is contained in:
Diego Devesa 2024-11-17 07:31:17 +01:00 committed by GitHub
parent 24203e9dd7
commit eda7e1d4f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1538,12 +1538,13 @@ bool ggml_backend_sched_reserve(ggml_backend_sched_t sched, struct ggml_cgraph *
ggml_backend_sched_split_graph(sched, measure_graph);
ggml_backend_sched_synchronize(sched);
if (!ggml_gallocr_reserve_n(sched->galloc, &sched->graph, sched->node_backend_ids, sched->leaf_backend_ids)) {
return false;
}
ggml_backend_sched_reset(sched);
ggml_backend_sched_synchronize(sched);
return true;
}