[project @ 2005-12-31 05:35:59 by jmb]

Fix attempted read/write to NULL pointer

svn path=/import/netsurf/; revision=1923
This commit is contained in:
John Mark Bell 2005-12-31 05:35:59 +00:00
parent f86f02b976
commit 43d4cfecf7
1 changed files with 25 additions and 14 deletions

View File

@ -525,6 +525,7 @@ void url_store_save(const char *file) {
/* get the minimum date for expiry */
min_date = time(NULL) - (60 * 60 * 24) * option_expire_url;
LOG(("%d", min_date));
/* file format version number */
fprintf(fp, "104\n");
@ -536,13 +537,15 @@ void url_store_save(const char *file) {
if ((url->data.last_visit > min_date) &&
(url->data.visits > 0) &&
(url->data.url_length <
MAXIMUM_URL_LENGTH))
MAXIMUM_URL_LENGTH)) {
url_count++;
}
free(normal);
normal = url_store_match_string(search->hostname);
if ((url_count > 0) && (normal)) {
fprintf(fp, "%s\n%i\n", normal, url_count);
for (url = search->url; url->next; url = url->next);
for (url = search->url; url && url->next;
url = url->next);
for (; url; url = url->previous)
if ((url->data.last_visit > min_date) &&
(url->data.visits > 0) &&
@ -554,13 +557,21 @@ void url_store_save(const char *file) {
if (bitmap)
thumb_file = bitmap->filename;
#endif
s = url->data.title;
for (i = 0; s[i] != '\0'; i++)
if (s[i] < 32) s[i] = ' ';
for (--i; ((i > 0) && (s[i] == ' ')); i--)
s[i] = '\0';
if (url->data.title)
if (url->data.title) {
s = url->data.title;
for (i = 0; s[i] != '\0';
i++)
if (s[i] < 32)
s[i] = ' ';
for (--i;
((i > 0) &&
(s[i] == ' '));
i--)
s[i] = '\0';
title = url->data.title;
}
else
title = "";
fprintf(fp, "%s\n%i\n%i\n%i\n%s\n%s\n",