Fixing some memory leaks

- Freeing ‘value’ variable when no longer needed in generic_record_read.
- Passing a pointer to ‘generic_record_read’ in order to know the lenght of the tcp array