eliminate redundant `exchange_malloc` function