History

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).

Andreas Rheinhardt committed 1 year ago

Commit 2fc310b1 parent 7927ac61 file · +1 −1Browse files

Unified · Split

libavcodec/hashtable.c+1−1
@@ -58,7 +58,7 @@ struct FFHashtableContext { · 57 unmodified lines
58 58
59int ff_hashtable_alloc(struct FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries)59int ff_hashtable_alloc(struct FFHashtableContext **ctx, size_t key_size, size_t val_size, size_t max_entries)
60{60{
61 struct FFHashtableContext *res = av_malloc(sizeof(struct FFHashtableContext));61 FFHashtableContext *res = av_mallocz(sizeof(*res));
62 if (!res)62 if (!res)
63 return AVERROR(ENOMEM);63 return AVERROR(ENOMEM);
64 res->key_size = key_size;64 res->key_size = key_size;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t