Fix resource leak and a null return value dereference

This commit is contained in:
David Crosby
2015-07-09 20:34:04 -06:00
committed by Tatsuya Kinoshita
parent dba9fe9753
commit 3120f496f7

View File

@@ -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);
}