[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: Fri, 13 Aug 2010 15:17:06 +0000 (UTC)
commit efc5940e863f74c2a6d76b1b7625722a71480ec9
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 9a63e00..0bbd929 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;
@@ -651,7 +652,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;
@@ -715,6 +715,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");
@@ -781,12 +787,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.
@@ -911,7 +911,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);
@@ -922,8 +921,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
- g_free (in_use_filename);
-
initialized = TRUE;
thread_ifaces = g_hash_table_new (NULL, NULL);
@@ -1007,19 +1004,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]