Linked list working for patient results in SQL query; however, having some memory leak.