summaryrefslogtreecommitdiff
path: root/content/urldb.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-11-22 14:12:03 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-11-22 14:12:03 +0000
commit63848419e245520ebfcfcf6ea9b87ae996a8d621 (patch)
tree48725897c7ba53c0df43e5f5e76b3d00b811f7c5 /content/urldb.c
parenta042e38548176930891aaa3b9f6c3ad927e2d824 (diff)
downloadnetsurf-63848419e245520ebfcfcf6ea9b87ae996a8d621.tar.gz
netsurf-63848419e245520ebfcfcf6ea9b87ae996a8d621.tar.bz2
Ensure urldb file handle is closed on error.
svn path=/trunk/netsurf/; revision=9693
Diffstat (limited to 'content/urldb.c')
-rw-r--r--content/urldb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/content/urldb.c b/content/urldb.c
index 68e39f10f..6b63eaa64 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -365,15 +365,20 @@ void urldb_load(const char *filename)
return;
}
- if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
+ if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) {
+ fclose(fp);
return;
+ }
+
version = atoi(s);
if (version < MIN_URL_FILE_VERSION) {
LOG(("Unsupported URL file version."));
+ fclose(fp);
return;
}
if (version > URL_FILE_VERSION) {
LOG(("Unknown URL file version."));
+ fclose(fp);
return;
}