Unifiy error msg if unable to allocate memory
Merge pull request #192 from alexander-zimmermann/nits

Unifiy error msg if unable to allocate memory
Fix compiler warning

Additionally, use an if statement instead of a switch statement, which
increases code readability.
Merge remote-tracking branch 'origin/next' into cleanup_controller