Changed determine_region_file to accept a buffer instead of creating a string on the heap

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>