Pavel <[email protected]> added the comment: I use: int ret = av_open_input_file(&format_ctx, "invalidfile.png", NULL, 0, NULL);
if invalidfile.png doesn't exist, then on return format_ctx is 0 and ret contains a error return (-2). At this point, I can't do anything anymore. The only way to fix it was to free context on error. I don't know internals of avio, but the next line after my patch, there is av_free(st); after that st->codec is leaked, so I addredd free just before that. valgrind ffmpeg_g -i /tmp/unexisting_file /tmp/out.avi : It doesn't necessarily use the same way to open files, and may go some other code path. I can't comment on ffmpeg cli ________________________________________________ FFmpeg issue tracker <[email protected]> <https://roundup.ffmpeg.org/issue2126> ________________________________________________
