Proper malloc with cast and add -Wextra