Commit c7065f1f authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/sendcmd: release file in case of failed allocation

Avoid hanging file.
parent 469a65b1
...@@ -398,8 +398,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -398,8 +398,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
/* create a 0-terminated string based on the read file */ /* create a 0-terminated string based on the read file */
buf = av_malloc(file_bufsize + 1); buf = av_malloc(file_bufsize + 1);
if (!buf) if (!buf) {
av_file_unmap(file_buf, file_bufsize);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
memcpy(buf, file_buf, file_bufsize); memcpy(buf, file_buf, file_bufsize);
buf[file_bufsize] = 0; buf[file_bufsize] = 0;
av_file_unmap(file_buf, file_bufsize); av_file_unmap(file_buf, file_bufsize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment