Hacker News new | ask | show | jobs
by Tarragon 1166 days ago
> So how can we handle this case safely? There are a few ways I can think of.

strdup:

> The strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with malloc(3), and can be freed with free(3).