Ensure urldb file handle is closed on error.

svn path=/trunk/netsurf/; revision=9693
This commit is contained in:
John Mark Bell 2009-11-22 14:12:03 +00:00
parent a042e38548
commit 63848419e2

View File

@ -365,15 +365,20 @@ void urldb_load(const char *filename)
return; return;
} }
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) {
fclose(fp);
return; return;
}
version = atoi(s); version = atoi(s);
if (version < MIN_URL_FILE_VERSION) { if (version < MIN_URL_FILE_VERSION) {
LOG(("Unsupported URL file version.")); LOG(("Unsupported URL file version."));
fclose(fp);
return; return;
} }
if (version > URL_FILE_VERSION) { if (version > URL_FILE_VERSION) {
LOG(("Unknown URL file version.")); LOG(("Unknown URL file version."));
fclose(fp);
return; return;
} }