Conditional jump or move depends on uninitialised value
Some general remarks to your code:


You should store the string length as a variable rather than calling it multiple times.
If you do strncpy(test, some_text, strlen(some_text) + 1) you can get rid of the strcat as strncpy will padd the remainder with \0 if src is less than n characters.
You don't need to test for NULL before free

a) because you'd get a segfault anyway before that line of code if it were NULL
b) because the standard guarantees that it is safe to call free(NULL)