Why is this a vulnerability? malloc() should return 0 and the function will then register the allocation failure and give up.
Looking at the code (for the first time in 11 years - sorry, I'm very rusty on this)...