summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2009-11-15 23:11:41 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2009-11-15 23:11:41 +0000
commitbc4abe90878b5550d1461287d5a9f060565c30b9 (patch)
tree9e99ab54797c6da043b1dccd6be7fa7d4bc88780
parent9e86512c4fa7851571571b9a2835c2f019ca2b6a (diff)
downloadnetsurf-bc4abe90878b5550d1461287d5a9f060565c30b9.tar.gz
netsurf-bc4abe90878b5550d1461287d5a9f060565c30b9.tar.bz2
Fix some potential issues with lists not being freed properly
svn path=/trunk/netsurf/; revision=9677
-rw-r--r--amiga/download.c10
-rwxr-xr-xamiga/gui.c1
-rwxr-xr-xamiga/object.c9
3 files changed, 11 insertions, 9 deletions
diff --git a/amiga/download.c b/amiga/download.c
index 8837e983e..48f719a60 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -224,17 +224,19 @@ void ami_free_download_list(struct List *dllist)
struct dlnode *node;
struct dlnode *nnode;
+ if(!dllist) return;
+ if(IsListEmpty(dllist)) return;
+
node = (struct dlnode *)GetHead((struct List *)dllist);
- while(nnode=(struct dlnode *)GetSucc((struct Node *)node))
+ do
{
+ nnode=(struct dlnode *)GetSucc((struct Node *)node);
free(node->node.ln_Name);
free(node->filename);
Remove((struct Node *)node);
FreeVec((struct Node *)node);
-
- node=nnode;
- }
+ }while(node=nnode);
}
void gui_window_save_as_link(struct gui_window *g, struct content *c)
diff --git a/amiga/gui.c b/amiga/gui.c
index 10b0994c2..90ffb8862 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1812,7 +1812,6 @@ void ami_quit_netsurf(void)
ami_close_all_tabs(gwin);
break;
}
- node = nnode;
} while(node = nnode);
}
diff --git a/amiga/object.c b/amiga/object.c
index f3b5374e2..a51be81c1 100755
--- a/amiga/object.c
+++ b/amiga/object.c
@@ -61,17 +61,18 @@ void FreeObjList(struct MinList *objlist)
struct nsObject *node;
struct nsObject *nnode;
+ if(IsMinListEmpty(objlist)) return;
node = (struct nsObject *)GetHead((struct List *)objlist);
- while(nnode=(struct nsObject *)GetSucc((struct Node *)node))
+ do
{
+ nnode=(struct nsObject *)GetSucc((struct Node *)node);
if(node->Type == AMINS_CALLBACK)
ami_remove_timer_event((struct nscallback *)node->objstruct);
DelObject(node);
-
- node=nnode;
- }
+
+ }while(node=nnode);
FreeVec(objlist);
}