tonioni / WinUAE

WinUAE Amiga emulator
http://www.winuae.net/
528 stars 86 forks source link

cfgfile_option_find_it returns address of local variable #263

Open midwan opened 7 months ago

midwan commented 7 months 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 7 months ago

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