In get_portmappings_in_range(), array[] is not updated when realloc() is not called, hence get_portmappings_in_range() is always null. This fix changes to fill array[].