Allocate memory before trying to use it

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>