[tracker/wal: 17/18] 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: 17/18] libtracker-data: Don't leak in_use_filename in db-manager
- Date: Mon, 16 Aug 2010 12:14:22 +0000 (UTC)
commit 1320f38904a6864781bc1a9f2273e4d13623db4d
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 c29677a..0ec2db8 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;
@@ -588,7 +589,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;
@@ -652,6 +652,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");
@@ -718,12 +724,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.
@@ -848,7 +848,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);
@@ -859,8 +858,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
- g_free (in_use_filename);
-
initialized = TRUE;
thread_ifaces = g_hash_table_new (NULL, NULL);
@@ -944,19 +941,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]