Message ID | c547bc23-b01a-3816-723d-f0e6e4b044ff@gmail.com |
---|---|
State | New |
Headers | show |
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... Moritz
diff --git a/libavdevice/dshow_pin.c b/libavdevice/dshow_pin.c index 664246da92..c0f8ec065d 100644 --- a/libavdevice/dshow_pin.c +++ b/libavdevice/dshow_pin.c @@ -249,8 +249,16 @@ libAVPin_Setup(libAVPin *this, libAVFilter *filter) return 1; } + +static void +libAVPin_Free(libAVPin *this) +{ + if (!this) + return; + av_freep(&this->imemvtbl); +} DECLARE_CREATE(libAVPin, libAVPin_Setup(this, filter), libAVFilter *filter) -DECLARE_DESTROY(libAVPin, nothing) +DECLARE_DESTROY(libAVPin, libAVPin_Free) /***************************************************************************** * libAVMemInputPin