From f5f4e6b1c5f8a07fa53c27bf81f02b8bf0380e92 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 16 Feb 2019 00:50:14 +0100 Subject: [PATCH] Allocate extradata with av_malloc() The extradata buffer is owned by libav, so it must be allocated with av_malloc(), not SDL_malloc(). This fixes a crash on Windows during avformat_free_context(). --- app/src/recorder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/recorder.c b/app/src/recorder.c index ea5a84d8..d69953dc 100644 --- a/app/src/recorder.c +++ b/app/src/recorder.c @@ -135,7 +135,7 @@ static SDL_bool recorder_write_header(struct recorder *recorder, AVPacket *packet) { AVStream *ostream = recorder->ctx->streams[0]; - uint8_t *extradata = SDL_malloc(packet->size * sizeof(uint8_t)); + uint8_t *extradata = av_malloc(packet->size * sizeof(uint8_t)); if (!extradata) { LOGC("Cannot allocate extradata"); return SDL_FALSE;