From: Paul Tsochantaris Date: Mon, 29 Jan 2024 22:19:29 +0000 (+0000) Subject: ggml alloc: Fix for null dereference on alloc failure (llama/5200) X-Git-Tag: upstream/0.0.1642~1017 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=fb8c9aa0d507c68d7b130a218d191754252003af;p=pkg%2Fggml%2Fsources%2Fggml ggml alloc: Fix for null dereference on alloc failure (llama/5200) * Fix for a null pointer dereference if a metal GGML buffer fails to be allocated * Freeing the allocated buffers rather than the pointer in ggml-alloc.c * Fixed the fix of the fix --- diff --git a/src/ggml-alloc.c b/src/ggml-alloc.c index dfe5ba2e..f9be6e1c 100644 --- a/src/ggml-alloc.c +++ b/src/ggml-alloc.c @@ -791,7 +791,7 @@ static bool alloc_tensor_range(struct ggml_context * ctx, for (size_t i = 0; i < *n_buffers; i++) { ggml_backend_buffer_free(*buffers[i]); } - free(buffers); + free(*buffers); return false; }