Fix error if malloc fails
Fix error if malloc fails

It's not very likely, but in case you're running out of memory malloc might fail and this change prevents that we're overwriting arbitrary data.
michael-hartmann/progressbar,niosus/progressbar,doches/progressbar,doches/progressbar,niosus/progressbar,michael-hartmann/progressbar