Skip to content

Commit

Permalink
r3.showdspf: Fix resource leak (#2295)
Browse files Browse the repository at this point in the history
Add missing fclose before returning from the loadrect function when out of memory.
  • Loading branch information
lbartoletti committed Apr 8, 2022
1 parent 3c7e0c5 commit c458350
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions raster3d/r3.showdspf/new_init_graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ int loadrect(char *name)
if (NULL ==
(buffer = (unsigned long *)G_malloc(xsiz * ysiz * sizeof(long)))) {
fprintf(stderr, "Out of memory\n");
fclose(fp);
return -1;
}

Expand Down

0 comments on commit c458350

Please sign in to comment.