How to "free" variable after end of the function?
<p>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.   </p>

<pre><code>char* someFunction(char* a, char* b) {
   char* result = (char*)malloc(la + 2 * sizeof(char));
   ...
   return result;
}
</code></pre>