snippets: Updated trim_string.c

Removed malloc from trim function (not needed)