I read from many question here in SO and some other articles regarding free() function in c that frees the memory of unused variables. In my case, I have the following code
strC is the return value of this function, so you don't call free(strC) inside the function itself. You need to free it outside the function, the time when this string is not used anymore.