free() on stack memory

后端 未结 5 1163
余生分开走
余生分开走 2020-12-06 18:07

I\'m supporting some c code on Solaris, and I\'ve seen something weird at least I think it is:

char new_login[64];
...
strcpy(new_login, (char *)login);
...
         


        
5条回答
  •  抹茶落季
    2020-12-06 18:42

    Definitely a bug. free() MUST ONLY be used for heap alloc'd memory, unless it's redefined to do something completely different, which I doubt to be the case.

提交回复
热议问题