Skip to content

Commit f5f4e6b

Browse files
committed
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().
1 parent 6c40dbd commit f5f4e6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/recorder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static SDL_bool
135135
recorder_write_header(struct recorder *recorder, AVPacket *packet) {
136136
AVStream *ostream = recorder->ctx->streams[0];
137137

138-
uint8_t *extradata = SDL_malloc(packet->size * sizeof(uint8_t));
138+
uint8_t *extradata = av_malloc(packet->size * sizeof(uint8_t));
139139
if (!extradata) {
140140
LOGC("Cannot allocate extradata");
141141
return SDL_FALSE;

0 commit comments

Comments
 (0)