aboutsummaryrefslogtreecommitdiffstats
path: root/w3mbookmark.c
diff options
context:
space:
mode:
authorDavid Crosby <dave@dafyddcrosby.com>2015-07-10 02:34:04 +0000
committerTatsuya Kinoshita <tats@debian.org>2015-08-11 12:59:27 +0000
commit3120f496f7bca284535f0213bdbc4c72754f0867 (patch)
tree2a7e84d5ab6aa3a8f70ffc22bf9508e07ffe164f /w3mbookmark.c
parentFix a divide-by-zero (diff)
downloadw3m-3120f496f7bca284535f0213bdbc4c72754f0867.tar.gz
w3m-3120f496f7bca284535f0213bdbc4c72754f0867.zip
Fix resource leak and a null return value dereference
Diffstat (limited to 'w3mbookmark.c')
-rw-r--r--w3mbookmark.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/w3mbookmark.c b/w3mbookmark.c
index fcbad11..4ffc630 100644
--- a/w3mbookmark.c
+++ b/w3mbookmark.c
@@ -81,6 +81,7 @@ print_bookmark_panel(char *bmark, char *url, char *title, char *charset)
printf("</select>\n");
}
printf(bkmark_src2, html_quote(url), html_quote(title));
+ fclose(f);
}
/* create new bookmark */
@@ -168,7 +169,10 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
/* In this case, a new bookmark is appeneded after the bookmark file */
return create_new_bookmark(bmark, section, title, url, "a");
}
- f = fopen(bmark, "w");
+ if ((f = fopen(bmark, "w")) == NULL) {
+ printf("\nCannot open bookmark %s\n", bmark);
+ return FALSE;
+ }
while (tl->nitem) {
fputs(popText(tl), f);
}