Message ID | 1367882708-21822-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/07/2013 07:25 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997293, Dereference after null check (FORWARD_NULL) > > Coverity caught a bug where we are closing fp even if it failed > to open. Close it only if it opens correctly and fp is not NULL. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_uefi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c > index 29cad80..f8678ab 100644 > --- a/src/lib/src/fwts_uefi.c > +++ b/src/lib/src/fwts_uefi.c > @@ -107,8 +107,8 @@ static int fwts_uefi_get_interface(char **path) > strcpy(efivar_path, "/sys/firmware/efi/vars"); > } > } > + fclose(fp); > } > - fclose(fp); > > *path = NULL; > > Acked-by: Alex Hung <alex.hung@canonical.com>
On 05/07/2013 07:25 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997293, Dereference after null check (FORWARD_NULL) > > Coverity caught a bug where we are closing fp even if it failed > to open. Close it only if it opens correctly and fp is not NULL. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_uefi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c > index 29cad80..f8678ab 100644 > --- a/src/lib/src/fwts_uefi.c > +++ b/src/lib/src/fwts_uefi.c > @@ -107,8 +107,8 @@ static int fwts_uefi_get_interface(char **path) > strcpy(efivar_path, "/sys/firmware/efi/vars"); > } > } > + fclose(fp); > } > - fclose(fp); > > *path = NULL; > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c index 29cad80..f8678ab 100644 --- a/src/lib/src/fwts_uefi.c +++ b/src/lib/src/fwts_uefi.c @@ -107,8 +107,8 @@ static int fwts_uefi_get_interface(char **path) strcpy(efivar_path, "/sys/firmware/efi/vars"); } } + fclose(fp); } - fclose(fp); *path = NULL;