Fixed two malloc related bugs

Hey,

I noticed two *alloc problems and did a fix.

Markus