Otherwise ff_hashtable_freep() would try to free uninitialized pointers upon allocation error (which happens in the corresponding test tool).
Unified · Split
| @@ -58,7 +58,7 @@ struct FFHashtableContext { · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | int 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 | 62 | if (!res) |
| 63 | 63 | return AVERROR(ENOMEM); |
| 64 | 64 | res->key_size = key_size; |