grub-fstest: fix descriptor leak

Found by: Coverity scan.
This commit is contained in:
Andrei Borzenkov 2015-01-30 22:45:58 +03:00
parent 12abe75aa0
commit 151c19a42a

View file

@ -570,12 +570,12 @@ argp_parser (int key, char *arg, struct argp_state *state)
return 0; return 0;
} }
real_size = fread (buf, 1, 1024, f); real_size = fread (buf, 1, 1024, f);
fclose (f);
if (real_size < 0) if (real_size < 0)
{ {
printf (_("%s: error:"), program_name); printf (_("%s: error:"), program_name);
printf (_("cannot read `%s': %s"), arg, strerror (errno)); printf (_("cannot read `%s': %s"), arg, strerror (errno));
printf ("\n"); printf ("\n");
fclose (f);
return 0; return 0;
} }
grub_zfs_add_key (buf, real_size, 0); grub_zfs_add_key (buf, real_size, 0);