[tracker/direct-access: 128/158] libtracker-data: Don't leak in_use_filename in db-manager
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/direct-access: 128/158] libtracker-data: Don't leak in_use_filename in db-manager
- Date: Thu, 5 Aug 2010 16:38:19 +0000 (UTC)
commit 0f78c7e10073c72f5136d79881cd79866b98bc2b
Author: Martyn Russell <martyn lanedo com>
Date: Thu Jul 22 17:27:56 2010 +0100
libtracker-data: Don't leak in_use_filename in db-manager
src/libtracker-data/tracker-db-manager.c | 31 +++++++++--------------------
1 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 43769a2..31d2cb2 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -144,6 +144,7 @@ static gchar *sql_dir;
static gchar *data_dir = NULL;
static gchar *user_data_dir = NULL;
static gchar *sys_tmp_dir = NULL;
+static gchar *in_use_filename = NULL;
static gpointer db_type_enum_class_pointer;
static TrackerDBManagerFlags old_flags = 0;
@@ -645,7 +646,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
const gchar *env_path;
gboolean need_reindex;
guint i;
- gchar *in_use_filename;
int in_use_file;
gboolean loaded = FALSE;
TrackerDBInterface *resources_iface;
@@ -709,6 +709,12 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
"tracker",
NULL);
+ in_use_filename = g_build_filename (g_get_user_data_dir (),
+ "tracker",
+ "data",
+ IN_USE_FILENAME,
+ NULL);
+
/* Make sure the directories exist */
g_message ("Checking database directories exist");
@@ -772,12 +778,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
tracker_db_interface_sqlite_enable_shared_cache ();
}
- in_use_filename = g_build_filename (g_get_user_data_dir (),
- "tracker",
- "data",
- IN_USE_FILENAME,
- NULL);
-
/* Should we reindex? If so, just remove all databases files,
* NOT the paths, note, that these paths are also used for
* other things like the nfs lock file.
@@ -902,7 +902,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
if ((flags & TRACKER_DB_MANAGER_READONLY) == 0) {
/* do not create in-use file for read-only mode (direct access) */
-
in_use_file = g_open (in_use_filename,
O_WRONLY | O_APPEND | O_CREAT | O_SYNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -913,8 +912,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
- g_free (in_use_filename);
-
initialized = TRUE;
thread_ifaces = g_hash_table_new (NULL, NULL);
@@ -998,19 +995,11 @@ tracker_db_manager_shutdown (void)
if ((tracker_db_manager_get_flags () & TRACKER_DB_MANAGER_READONLY) == 0) {
/* do not delete in-use file for read-only mode (direct access) */
-
- gchar *in_use_filename;
-
- in_use_filename = g_build_filename (g_get_user_data_dir (),
- "tracker",
- "data",
- IN_USE_FILENAME,
- NULL);
-
g_unlink (in_use_filename);
-
- g_free (in_use_filename);
}
+
+ g_free (in_use_filename);
+ in_use_filename = NULL;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]