Revert "Revert "MRP: Added casts to malloc() results" to get mrpd to compile again"

This reverts commit 05a61c04c286c49750db1169d4276e4050ab0921.
MRP: correct malloc() pointer casts