| 6 |
| 7 | Fixes: Stack overflow |
| 8 | Found-by: Joshua Rogers <joshua.rogers@aisle.com> |
| 9 | Fixes: tyKGcmR25mD8 |
| 10 | --- |
| 11 | libavutil/encryption_info.c | 9 ++++++--- |
| 12 | 1 file changed, 6 insertions(+), 3 deletions(-) |
| 13 |
| 14 | diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c |
| 15 | index a3eb955d2d..6fc3e33842 100644 |
| 16 | --- a/libavutil/encryption_info.c |
| 17 | +++ b/libavutil/encryption_info.c |
| 18 | @@ -218,16 +218,19 @@ AVEncryptionInitInfo *av_encryption_init_info_alloc( |
| 19 |
| 20 | void av_encryption_init_info_free(AVEncryptionInitInfo *info) |
| 21 | { |
| 22 | - uint32_t i; |
| 23 | - if (info) { |
| 24 | + while (info) { |
| 25 | + AVEncryptionInitInfo *next = info->next; |
| 26 | + uint32_t i; |
| 27 | + |
| 28 | for (i = 0; i < info->num_key_ids; i++) { |
| 29 | av_free(info->key_ids[i]); |
| 30 | } |
| 31 | - av_encryption_init_info_free(info->next); |
| 32 | av_free(info->system_id); |
| 33 | av_free(info->key_ids); |
| 34 | av_free(info->data); |
| 35 | av_free(info); |
| 36 | + |
| 37 | + info = next; |
| 38 | } |
| 39 | } |
| 40 |
| 41 | -- |
| 42 | 2.55.0 |
| 43 |
| 44 |