Merge pull request #4446 from akallabeth/sam_crash_fix

Fix #3335: Do not call fclose on NULL file.
This commit is contained in:
David Fort 2018-02-16 09:30:27 +01:00 committed by GitHub
commit 420f34f63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,9 +52,7 @@ WINPR_SAM* SamOpen(const char* filename, BOOL readOnly)
filename = WINPR_SAM_FILE;
if (readOnly)
{
fp = fopen(filename, "r");
}
else
{
fp = fopen(filename, "r+");
@ -79,8 +77,6 @@ WINPR_SAM* SamOpen(const char* filename, BOOL readOnly)
else
{
WLog_DBG(TAG, "Could not open SAM file!");
fclose(fp);
free(sam);
return NULL;
}