microsoft / ms-tpm-20-ref

Reference implementation of the TCG Trusted Platform Module 2.0 specification.
Other
343 stars 133 forks source link

Fix broken NULL check when closing NV file. #16

Closed flihp closed 6 years ago

flihp commented 6 years ago

The indentation in this block of code is misleading: https://github.com/Microsoft/ms-tpm-20-ref/blob/master/TPMCmd/Platform/src/NVMem.c#L208

The call to 'fclose' immediately follows a conditional and is indented in such a way as to lead the reader to believe it is within the scope of the conditional. The conditional however is immediately followed by a ';' on the same line which makes it a no-op and causes the call to 'fclose' to happen regardless of the result of the test. Removing this ';' will get you the intended behavior.

Apologies for not sending a patch but I'm still barred from doing so on account of the CCLA.

amarochk commented 6 years ago

Had been fixed as part of another patch.