Fix double-free on error

If writing the recording header fails, do not clean the resources
immediately to avoid double-free.
This commit is contained in:
Romain Vimont 2019-07-12 21:05:45 +02:00
parent 4961256123
commit 3c55d0c69b

View file

@ -151,9 +151,6 @@ recorder_write_header(struct recorder *recorder, const AVPacket *packet) {
int ret = avformat_write_header(recorder->ctx, NULL); int ret = avformat_write_header(recorder->ctx, NULL);
if (ret < 0) { if (ret < 0) {
LOGE("Failed to write header to %s", recorder->filename); LOGE("Failed to write header to %s", recorder->filename);
SDL_free(extradata);
avio_closep(&recorder->ctx->pb);
avformat_free_context(recorder->ctx);
return false; return false;
} }