what is the right way to free an allocated memory after executing function in C (via malloc)? I need to alloc memory, use it somehow and return it back, than I have to free it.
char* someFunction(char* a, char* b) {
char* result = (char*)malloc(la + 2 * sizeof(char));
...
return result;
}