Add more uses of memdup, mempcpy