Egypt has freed a blogger who served a four-year prison term on a conviction of insulting Islam and Egyptian President Hosni Mubarak .