Refactor memory allocation to prepare for DMI struct parsing