changeset 236:412cf266c90d

- Fixed a memory leak in nav.c.
author jcid
date Sun, 25 May 2008 21:08:25 +0200
parents 480d368c4b2f
children 1537123b7451
files ChangeLog src/nav.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat May 24 20:52:58 2008 +0200
+++ b/ChangeLog	Sun May 25 21:08:25 2008 +0200
@@ -150,6 +150,7 @@
  - Made dialogs use font_factor (e.g. view source).
  - Implemented the SELECT element in FORMS!
  - Implemented MULTIPLE SELECT in FORMS.
+ - Fixed a memory leak in nav.c
    Patches: Jeremy Henty
 +- Added int32_t, EAI_NODATA and iconv tests for FreeBSD.
    Patch: Thomas-Martin Seck
--- a/src/nav.c	Sat May 24 20:52:58 2008 +0200
+++ b/src/nav.c	Sun May 25 21:08:25 2008 +0200
@@ -116,17 +116,18 @@
    while (pos < dList_length(bw->nav_stack)) {
       data = dList_nth_data(bw->nav_stack, pos);
       dList_remove_fast (bw->nav_stack, data);
+      dFree(data);
    }
 }
 
 /*
  * Insert a nav_stack_item into the stack at a given position.
  */
-static void Nav_stack_insert(BrowserWindow *bw, int url_idx,
-                             int stack_idx, int posx, int posy)
+static void Nav_stack_append(BrowserWindow *bw, int url_idx)
 {
    void *data;
    nav_stack_item *nsi;
+   int stack_idx = dList_length (bw->nav_stack);
 
    dReturn_if_fail (bw != NULL);
 
@@ -137,9 +138,9 @@
    /* Insert the new element */
    nsi = dNew(nav_stack_item, 1);
    nsi->url_idx = url_idx;
-   nsi->posx = posx;
-   nsi->posy = posy;
-   dList_insert_pos (bw->nav_stack, nsi, stack_idx);
+   nsi->posx = 0;
+   nsi->posy = 0;
+   dList_append (bw->nav_stack, nsi);
 }
 
 /*
@@ -297,7 +298,7 @@
          MSG("a_Nav_expect_done: reload!\n");
       } else {
          Nav_stack_truncate(bw, a_Nav_stack_ptr(bw) + 1);
-         Nav_stack_insert(bw, url_idx, a_Nav_stack_ptr(bw) + 1, 0, 0);
+         Nav_stack_append(bw, url_idx);
          Nav_stack_move_ptr(bw, 1);
       }