[tracker/wal: 18/20] 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/wal: 18/20] libtracker-data: Don't leak in_use_filename in db-manager
- Date: Wed, 11 Aug 2010 15:59:53 +0000 (UTC)
commit 478ea83e74cb9b31b10faafdaaeb208e264632e8
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 eb51b6d..e80b71e 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -145,6 +145,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;
@@ -647,7 +648,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;
@@ -711,6 +711,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");
@@ -777,12 +783,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.
@@ -907,7 +907,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);
@@ -918,8 +917,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
- g_free (in_use_filename);
-
initialized = TRUE;
thread_ifaces = g_hash_table_new (NULL, NULL);
@@ -1003,19 +1000,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]