eal: fix crash when allocating memory on a control thread