Fix a few more valgrind issues.
Add another unit test for one of the refactored functions in process_request.c