1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/hashtable: Zero-initialize hashtable

Otherwise ff_hashtable_freep() would try to free uninitialized
pointers upon allocation error (which happens in the corresponding
test tool).

Reviewed-by: Emma Worley <emma@emma.gg>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-06-03 21:42:24 +02:00
parent 7927ac63ef
commit 2fc310b2f2

View File

@ -58,7 +58,7 @@ struct FFHashtableContext {
int ff_hashtable_alloc(struct FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries)
{
struct FFHashtableContext *res = av_malloc(sizeof(struct FFHashtableContext));
FFHashtableContext *res = av_mallocz(sizeof(*res));
if (!res)
return AVERROR(ENOMEM);
res->key_size = key_size;