Fix memory corruption
Fix memory corruption

If the array is resized following the increment_size call, there is the
possibility that the array data will point to a new location in memory
following a realloc. The local data variable will point to a wrong location
in this case. Fix by updating the local variables after the resizing.

mihaiolteanu/algorithms,mihaiolteanu/algorithms,mihaiolteanu/algorithms