Skip to content

Commit

Permalink
Merge pull request #149 from flaviojs/fix-descriptor-leaks-mips64_loa…
Browse files Browse the repository at this point in the history
…d_raw_image

Fix descriptor leaks in mips64_load_raw_image
  • Loading branch information
grossmj authored Mar 9, 2024
2 parents 370c1f7 + 71af69a commit 00a91df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stable/mips64.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ int mips64_load_raw_image(cpu_mips_t *cpu,char *filename,m_uint64_t vaddr)

if (fstat(fileno(bfd),&file_info) == -1) {
perror("stat");
fclose(bfd);
return(-1);
}

Expand All @@ -880,6 +881,7 @@ int mips64_load_raw_image(cpu_mips_t *cpu,char *filename,m_uint64_t vaddr)
if (!haddr) {
fprintf(stderr,"load_raw_image: invalid load address 0x%llx\n",
vaddr);
fclose(bfd);
return(-1);
}

Expand Down
2 changes: 2 additions & 0 deletions unstable/mips64.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ int mips64_load_raw_image(cpu_mips_t *cpu,char *filename,m_uint64_t vaddr)

if (fstat(fileno(bfd),&file_info) == -1) {
perror("stat");
fclose(bfd);
return(-1);
}

Expand All @@ -963,6 +964,7 @@ int mips64_load_raw_image(cpu_mips_t *cpu,char *filename,m_uint64_t vaddr)
if (!haddr) {
fprintf(stderr,"load_raw_image: invalid load address 0x%llx\n",
vaddr);
fclose(bfd);
return(-1);
}

Expand Down

0 comments on commit 00a91df

Please sign in to comment.