Fix possible overflow when using /menu
sysinfo: Simplify remove_leading_whitespace()

Also fixes a possible overflow
Replaced various uses of malloc with glib versions.

glib versions abort() on failure, so checking the result for NULL is unnecessary.
Fixup