Not dumb. I think you're correct that this should be freeing on val == 0. If another thread races in and decrements between this threads dec and the actual call to free, then we want it to exit without invoking the callback.