{"action":"opened","issue":{"url":"https://api.github.com/repos/asb2m10/dexed/issues/44","labels_url":"https://api.github.com/repos/asb2m10/dexed/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/asb2m10/dexed/issues/44/comments","events_url":"https://api.github.com/repos/asb2m10/dexed/issues/44/events","html_url":"https://github.com/asb2m10/dexed/issues/44","id":115521869,"number":44,"title":"Return of reference to stack variable","user":{"login":"JDCodeIt","id":12190900,"avatar_url":"https://avatars.githubusercontent.com/u/12190900?v=3","gravatar_id":"","url":"https://api.github.com/users/JDCodeIt","html_url":"https://github.com/JDCodeIt","followers_url":"https://api.github.com/users/JDCodeIt/followers","following_url":"https://api.github.com/users/JDCodeIt/following{/other_user}","gists_url":"https://api.github.com/users/JDCodeIt/gists{/gist_id}","starred_url":"https://api.github.com/users/JDCodeIt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JDCodeIt/subscriptions","organizations_url":"https://api.github.com/users/JDCodeIt/orgs","repos_url":"https://api.github.com/users/JDCodeIt/repos","events_url":"https://api.github.com/users/JDCodeIt/events{/privacy}","received_events_url":"https://api.github.com/users/JDCodeIt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-06T15:07:01Z","updated_at":"2015-11-06T15:07:01Z","closed_at":null,"body":"I noticed while compiling under Linux, there was a warning about this function returning a stack variable, which of course may not exist when the caller goes to look for it. You might consider making this \"static\" so it is on the heap instead.\r\n\r\n```c++\r\nImage &findImage(String path) {\r\n    Image img;\r\n    // change the above to static Image img;\r\n\r\n    if ( path.length() <= 3 ) \r\n        return img;\r\n    File imgFile(path);\r\n    img = ImageCache::getFromFile(imgFile);\r\n    return img;\r\n}\r\n```"}}