tonioni / WinUAE

WinUAE Amiga emulator
http://www.winuae.net/
552 stars 90 forks source link

cfgfile_option_find_it returns address of local variable #263

Open midwan opened 1 year ago

midwan commented 1 year ago

In cfgfile.cpp, function:

static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool checkequals)
{
    TCHAR buf[MAX_DPATH];

I'm seeing a compiler warning: warning: function may return address of local variable [-Wreturn-local-addr]

Should that variable be marked as static perhaps?

tonioni commented 1 year ago

It does not return local variable, it always returns newly allocated string.