summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-07-04 14:07:07 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-07-04 14:07:07 +0000
commite68f20d1c0612877afefcc581237bb5c70c8dbe6 (patch)
treecfcc850bd47e2d4498ac5a39bf700c8909d76661
parent5e2567370d9be341a18203a5df9206ebe32e1fb9 (diff)
downloadnetsurf-e68f20d1c0612877afefcc581237bb5c70c8dbe6.tar.gz
netsurf-e68f20d1c0612877afefcc581237bb5c70c8dbe6.tar.bz2
Stop lack of history entries from writing to invalid pointers (fix 1479657)
svn path=/trunk/netsurf/; revision=2708
-rw-r--r--desktop/history_core.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/desktop/history_core.c b/desktop/history_core.c
index 2a0b366ca..e53bdf314 100644
--- a/desktop/history_core.c
+++ b/desktop/history_core.c
@@ -87,15 +87,13 @@ struct history *history_create(void)
{
struct history *history;
- history = malloc(sizeof *history);
+ history = calloc(1, sizeof *history);
if (!history) {
warn_user("NoMemory", 0);
return 0;
}
-
- history->start = 0;
- history->current = 0;
-
+ history->width = RIGHT_MARGIN / 2;
+ history->height = BOTTOM_MARGIN / 2;
return history;
}
@@ -440,8 +438,12 @@ void history_layout(struct history *history)
bool shuffle = tp->tm_mon == 3 && tp->tm_mday == 1;
history->width = 0;
- history->height = history_layout_subtree(history, history->start,
- RIGHT_MARGIN / 2, BOTTOM_MARGIN / 2, shuffle);
+ if (history->start)
+ history->height = history_layout_subtree(history,
+ history->start, RIGHT_MARGIN / 2, BOTTOM_MARGIN / 2,
+ shuffle);
+ else
+ history->height = 0;
if (shuffle) {
history->width = 600 + WIDTH;
history->height = 400 + HEIGHT;
@@ -470,7 +472,7 @@ int history_layout_subtree(struct history *history,
if (history->width < x + WIDTH)
history->width = x + WIDTH;
-
+
if (!entry->forward) {
entry->x = x;
entry->y = y;