Skip to content

Commit

Permalink
Merge pull request #150 from flaviojs/fix-descriptor-leaks-ppc32_load…
Browse files Browse the repository at this point in the history
…_raw_image

Fix resource leaks in ppc32_load_raw_image
  • Loading branch information
grossmj authored Mar 9, 2024
2 parents 00a91df + 15ecf3d commit 9f60d7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stable/ppc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ int ppc32_load_raw_image(cpu_ppc_t *cpu,char *filename,m_uint32_t vaddr)

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

Expand All @@ -507,6 +508,7 @@ int ppc32_load_raw_image(cpu_ppc_t *cpu,char *filename,m_uint32_t vaddr)
if (!haddr) {
fprintf(stderr,"load_raw_image: invalid load address 0x%8.8x\n",
vaddr);
fclose(bfd);
return(-1);
}

Expand Down
2 changes: 2 additions & 0 deletions unstable/ppc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ int ppc32_load_raw_image(cpu_ppc_t *cpu,char *filename,m_uint32_t vaddr)

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

Expand All @@ -504,6 +505,7 @@ int ppc32_load_raw_image(cpu_ppc_t *cpu,char *filename,m_uint32_t vaddr)
if (!haddr) {
fprintf(stderr,"load_raw_image: invalid load address 0x%8.8x\n",
vaddr);
fclose(bfd);
return(-1);
}

Expand Down

0 comments on commit 9f60d7f

Please sign in to comment.