]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml alloc: Fix for null dereference on alloc failure (#5200)
authorPaul Tsochantaris <redacted>
Mon, 29 Jan 2024 22:19:29 +0000 (22:19 +0000)
committerGitHub <redacted>
Mon, 29 Jan 2024 22:19:29 +0000 (23:19 +0100)
* 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

ggml-alloc.c

index dfe5ba2e578acc48cf3ea300dd481d3e2ee023f5..f9be6e1cbc89f3379caebe54427e400f4743a582 100644 (file)
@@ -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;
     }