I came across lot of functions returning char pointers in one legacy application. Some of them returning pointers to local character arrays. It seems to be causing crashes a
Actually, the best would be to modify f1() to use malloc(). Your solution isn't near defined behavior.