Seg faulting at the memcpy location