Allocation was happening later, causing possible use of stack variables of caller function, which could be invalid. Signed-off-by: Piyush Shah <piyush@espressif.com>