[TASK] Add calls to sql_free_result()

Change-Id: I7805de8c0108aa54957e8eef5420c146f0771327
Resolves: #59725
Reviewed-on: https://review.typo3.org/30937
Reviewed-by: Ivan Dharma Kartolo
Tested-by: Ivan Dharma Kartolo