cache: zero initialize the key string

I thought `cvalloc` wraps `calloc`, but it's `malloc`...

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-18 01:16:58 +00:00
parent 5fa870ae66
commit d1888b612c
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ int cache_get_or_fetch(struct cache *c, const char *key, size_t keylen,
return err;
}
// Add a NUL terminator to make things easier
(*value)->key = cvalloc(keylen + 1);
(*value)->key = ccalloc(keylen + 1, char);
memcpy((*value)->key, key, keylen);
HASH_ADD_KEYPTR(hh, c->entries, (*value)->key, keylen, *value);