My error is double free, and I get it while I'm printing out x4, so it's after the array has already been built and sorted (build just does class assignments s.t. A = x and n = m).
Just the pointer. Also, the same pointer is used for implementations of mergesort, heapsort, and insertion sort in the same program (with mergesort and insertion sort copying the pointer).