Paul Tsochantaris commited on
Commit
8181686
·
unverified ·
1 Parent(s): f5fd92d

ggml alloc: Fix for null dereference on alloc failure (llama/5200)

Browse files

* 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

Files changed (1) hide show
  1. ggml-alloc.c +1 -1
ggml-alloc.c CHANGED
@@ -791,7 +791,7 @@ static bool alloc_tensor_range(struct ggml_context * ctx,
791
  for (size_t i = 0; i < *n_buffers; i++) {
792
  ggml_backend_buffer_free(*buffers[i]);
793
  }
794
- free(buffers);
795
  return false;
796
  }
797
 
 
791
  for (size_t i = 0; i < *n_buffers; i++) {
792
  ggml_backend_buffer_free(*buffers[i]);
793
  }
794
+ free(*buffers);
795
  return false;
796
  }
797