react: Fixed memory corruption/leak