Skip to content

Commit

Permalink
r.out.png: reset file pointer to NULL after fclose (OSGeo#4220)
Browse files Browse the repository at this point in the history
This patch continues the work from 917ba58. It's a good
practice to immediately reset the file pointer once we
do fclose on it, as it prevents using/closing descriptor
allocated to another file in the future execution paths.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
  • Loading branch information
ymdatta authored and Mahesh1998 committed Sep 19, 2024
1 parent aafc02e commit 6ef64e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion raster/r.out.png/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,10 @@ int main(int argc, char *argv[])
/* G_free (info_ptr); */
png_destroy_write_struct(&png_ptr, &info_ptr); /* al 11/2000 */

if (fp)
if (fp) {
fclose(fp);
fp = NULL;
}

if (wld_flag->answer) {
if (do_stdout)
Expand Down

0 comments on commit 6ef64e5

Please sign in to comment.