out:
>>>>>>>>> return err;
free(RxData_tot); // free memory
free(colore); // free memory
free(scan); // free memory
Your function never reaches the memory free functions as it returns before that with the err code. Removing that return altogether seems like a very good idea to me.
By the way it is not a very good idea to return anything else than noErr from CINRun(). This will immediately abort the entire application. It would be better to just return the error in an extra error variable and deal with the error in traditional ways through error clusters for instance.
Rolf Kalbermatter
My Blog 
DEMO, Electronic and Mechanical Support department, room 36.LB00.390