Skip to content

Commit cc06f11

Browse files
committed
Fix crash of test-tokenizer-0 under Debug build
1 parent b8c8dda commit cc06f11

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llama.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ struct llama_layer {
165165
};
166166

167167
struct llama_kv_cache {
168-
struct ggml_tensor * k;
169-
struct ggml_tensor * v;
168+
struct ggml_tensor * k = NULL;
169+
struct ggml_tensor * v = NULL;
170170

171171
struct ggml_context * ctx = NULL;
172172

@@ -180,8 +180,12 @@ struct llama_kv_cache {
180180
}
181181

182182
#ifdef GGML_USE_CUBLAS
183+
if (k) {
183184
ggml_cuda_free_data(k);
185+
}
186+
if (v) {
184187
ggml_cuda_free_data(v);
188+
}
185189
#endif // GGML_USE_CUBLAS
186190
}
187191
};

0 commit comments

Comments
 (0)