[PATCH v2 1/6] reg: Use malloc() instead of heap_xalloc()