awx: improve memory allocation handling