summaryrefslogtreecommitdiff
path: root/epan/geoip_db.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/geoip_db.c')
-rw-r--r--epan/geoip_db.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/epan/geoip_db.c b/epan/geoip_db.c
index 3be70713a2..f972ea0a4b 100644
--- a/epan/geoip_db.c
+++ b/epan/geoip_db.c
@@ -142,9 +142,7 @@ static void geoip_db_path_free_cb(void* p) {
g_free(m->path);
}
-/* called every time the user presses "Apply" or "OK in the list of
- * GeoIP directories, and also once on startup */
-static void geoip_db_post_update_cb(void) {
+static void geoip_dat_cleanup(void) {
GeoIP *gi;
guint i;
@@ -172,7 +170,17 @@ static void geoip_db_post_update_cb(void) {
}
/* finally, free the array itself */
g_array_free(geoip_dat_arr, TRUE);
+ geoip_dat_arr = NULL;
}
+}
+
+/* called every time the user presses "Apply" or "OK in the list of
+ * GeoIP directories, and also once on startup */
+static void geoip_db_post_update_cb(void) {
+ guint i;
+ GeoIP* gi;
+
+ geoip_dat_cleanup();
/* allocate the array */
geoip_dat_arr = g_array_new(FALSE, FALSE, sizeof(GeoIP *));
@@ -203,6 +211,11 @@ static void geoip_db_post_update_cb(void) {
g_array_append_val(geoip_dat_arr, gi);
}
+static void geoip_db_cleanup(void)
+{
+ geoip_dat_cleanup();
+}
+
/**
* Initialize GeoIP lookups
*/
@@ -228,6 +241,7 @@ geoip_db_pref_init(module_t *nameres)
NULL,
geoip_db_path_free_cb,
geoip_db_post_update_cb,
+ geoip_db_cleanup,
geoip_db_paths_fields);
prefs_register_uat_preference(nameres,