WinUAE icon indicating copy to clipboard operation
WinUAE copied to clipboard

cfgfile_option_find_it returns address of local variable

Open midwan opened this issue 1 year ago • 1 comments

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?

midwan avatar Nov 15 '23 12:11 midwan

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

tonioni avatar Nov 15 '23 15:11 tonioni