Correct loop range for gguf_remove_key and code format
This commit is contained in:
parent
29ed5d60e1
commit
ad0710aa8b
1 changed files with 2 additions and 1 deletions
3
ggml.c
3
ggml.c
|
@ -21152,8 +21152,9 @@ void gguf_remove_key(struct gguf_context * ctx, const char * key) {
|
|||
const int idx = gguf_find_key(ctx, key);
|
||||
if (idx >= 0) {
|
||||
const int n_kv = gguf_get_n_kv(ctx);
|
||||
for (int i = idx; i < n_kv; ++i)
|
||||
for (int i = idx; i < n_kv-1; ++i) {
|
||||
ctx->kv[i] = ctx->kv[i+1];
|
||||
}
|
||||
ctx->kv = realloc(ctx->kv, (n_kv - 1) * sizeof(struct gguf_kv));
|
||||
ctx->header.n_kv--;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue