[FFmpeg-devel] Possible memory leaks in dshow capture

Moritz Barsnick barsnick at gmx.net
Wed Jan 2 01:52:54 EET 2019

On Tue, Jan 01, 2019 at 18:22:42 -0300, James Almer wrote:
> >> +    if (!this)
> >> +        return
> >> +    av_freep(&this->imemvtbl);
> > 
> > Do add a semicolon after "return" for good measure. ;)
> Huh, curious, gcc 8 (mingw-w64) compiled this just fine without the
> semicolon.

Oh my. ;-)

"Just fine" means it didn't give you a warning. It produced unintended
code though - unless it additionally optimizes the av_freep() call
away, as libAVPin_Free() is supposed to return void anyway. Obviously
since av_freep() itself produces a void return value, gcc assumes this
is okay. Otherwise, you would have gotten:
warning: ‘return’ with a value, in function returning void

I don't know how to tell gcc to warn about it - except for the funky
new "misleading indentation" warnings.

Sorry for OT...


More information about the ffmpeg-devel mailing list