]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
metal : fix uninitialized abort_callback (llama/8968)
authorslaren <redacted>
Sat, 10 Aug 2024 13:42:10 +0000 (15:42 +0200)
committerGeorgi Gerganov <redacted>
Sun, 11 Aug 2024 08:06:15 +0000 (11:06 +0300)
src/ggml-metal.m

index 9fc08ab3aa5cc718abd977127e7663a32f719202..aad189430ab0b3f425de57b11b5cd528656906e7 100644 (file)
@@ -310,7 +310,7 @@ static struct ggml_backend_metal_context * ggml_metal_init(int n_cb) {
     GGML_METAL_LOG_INFO("%s: picking default device: %s\n", __func__, [[device name] UTF8String]);
 
     // Configure context
-    struct ggml_backend_metal_context * ctx = malloc(sizeof(struct ggml_backend_metal_context));
+    struct ggml_backend_metal_context * ctx = calloc(1, sizeof(struct ggml_backend_metal_context));
     ctx->device = device;
     ctx->n_cb   = MIN(n_cb, GGML_METAL_MAX_BUFFERS);
     ctx->queue  = [ctx->device newCommandQueue];