Fix checking return value of fread()
Merge pull request #1501 from iij/pr_fix_read_debug_section

Fix checking return value of fread()