summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-05-31 17:22:07 -0400
committercorvid <corvid@lavabit.com>2009-05-31 17:22:07 -0400
commit292f3cf782f4ea6aefb7b176fa3448f1f7cce1f9 (patch)
treedecc69cb2565859f82681babbcf0a67cf544a040 /src
parentedb215a2eca45c5ba738fe9629d0fb91ec801d56 (diff)
Bound at-exit memory deallocation
Diffstat (limited to 'src')
-rw-r--r--src/IO/http.c1
-rw-r--r--src/dillo.cc21
-rw-r--r--src/history.c2
-rw-r--r--src/history.h2
-rw-r--r--src/prefs.c21
-rw-r--r--src/prefs.h1
6 files changed, 45 insertions, 3 deletions
diff --git a/src/IO/http.c b/src/IO/http.c
index 749c75b5..55ba3502 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -548,4 +548,5 @@ void a_Http_freeall(void)
a_Klist_free(&ValidSocks);
a_Url_free(HTTP_Proxy);
dFree(HTTP_Proxy_Auth_base64);
+ dFree(HTTP_Language_hdr);
}
diff --git a/src/dillo.cc b/src/dillo.cc
index 238cdb3f..bfcdad48 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -38,6 +38,7 @@
#include "bw.h"
#include "misc.h"
#include "nav.h"
+#include "history.h"
#include "dns.h"
#include "web.hh"
@@ -349,5 +350,23 @@ int main(int argc, char **argv)
}
}
- return fltk::run();
+ fltk::run();
+
+ /*
+ * Memory deallocating routines
+ * (This can be left to the OS, but we'll do it, with a view to test
+ * and fix our memory management)
+ */
+ a_Cookies_freeall();
+ a_Cache_freeall();
+ a_Dicache_freeall();
+ a_Http_freeall();
+ a_Dns_freeall();
+ a_History_freeall();
+ a_Prefs_freeall();
+ /* TODO: auth, css */
+
+ //a_Dpi_bye_dpid();
+ MSG("Dillo: normal exit!\n");
+ return 0;
}
diff --git a/src/history.c b/src/history.c
index 626c3015..d90d457e 100644
--- a/src/history.c
+++ b/src/history.c
@@ -149,7 +149,7 @@ void a_History_set_title_by_url(const DilloUrl *url, const char *title)
/*
* Free all the memory used by this module
*/
-void a_History_free()
+void a_History_freeall()
{
int i;
diff --git a/src/history.h b/src/history.h
index 4d7ec467..3b8fe3d3 100644
--- a/src/history.h
+++ b/src/history.h
@@ -14,7 +14,7 @@ void a_History_set_title_by_url(const DilloUrl *url, const char *title);
DilloUrl *a_History_get_url(int idx);
const char *a_History_get_title(int idx, int force);
const char *a_History_get_title_by_url(const DilloUrl *url, int force);
-void a_History_free(void);
+void a_History_freeall(void);
#ifdef __cplusplus
diff --git a/src/prefs.c b/src/prefs.c
index 7654c0c8..4b8421cd 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -79,3 +79,24 @@ void a_Prefs_init(void)
prefs.w3c_plus_heuristics = TRUE;
}
+/*
+ * memory-deallocation
+ * (Call this one at exit time)
+ */
+void a_Prefs_freeall(void)
+{
+ dFree(prefs.font_cursive);
+ dFree(prefs.font_fantasy);
+ dFree(prefs.font_monospace);
+ dFree(prefs.font_sans_serif);
+ dFree(prefs.font_serif);
+ a_Url_free(prefs.home);
+ dFree(prefs.http_language);
+ a_Url_free(prefs.http_proxy);
+ dFree(prefs.http_proxyuser);
+ dFree(prefs.http_referer);
+ dFree(prefs.no_proxy);
+ dFree(prefs.save_dir);
+ dFree(prefs.search_url);
+ a_Url_free(prefs.start_page);
+}
diff --git a/src/prefs.h b/src/prefs.h
index f7b5a50b..da7a90a7 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -97,6 +97,7 @@ struct _DilloPrefs {
extern DilloPrefs prefs;
void a_Prefs_init(void);
+void a_Prefs_freeall(void);
#ifdef __cplusplus
}