Skip to content

Commit

Permalink
ggml alloc: Fix for null dereference on alloc failure (#5200)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ptsochantaris authored Jan 29, 2024
1 parent 6daa69e commit ceebbb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ggml-alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ceebbb5

Please sign in to comment.