Fix some leaks in the inotify code

Also avoid creating some unused objects. Patch by Carlos Garnacho,
bug 613057
This commit is contained in:
Matthias Clasen 2010-07-09 08:33:27 -04:00
parent c24a29e13b
commit 551461b23a

View File

@ -167,19 +167,17 @@ ih_event_callback (ik_event_t *event,
{ {
gchar *fullpath; gchar *fullpath;
GFileMonitorEvent eflags; GFileMonitorEvent eflags;
GFile* parent;
GFile* child; GFile* child;
GFile* other; GFile* other;
eflags = ih_mask_to_EventFlags (event->mask); eflags = ih_mask_to_EventFlags (event->mask);
parent = g_file_new_for_path (sub->dirname);
fullpath = _ih_fullpath_from_event (event, sub->dirname); fullpath = _ih_fullpath_from_event (event, sub->dirname);
child = g_file_new_for_path (fullpath); child = g_file_new_for_path (fullpath);
g_free (fullpath); g_free (fullpath);
if (ih_event_is_paired_move (event) && sub->pair_moves) if (ih_event_is_paired_move (event) && sub->pair_moves)
{ {
char *parent_dir = (char *) _ip_get_path_for_wd (event->pair->wd); const char *parent_dir = (char *) _ip_get_path_for_wd (event->pair->wd);
fullpath = _ih_fullpath_from_event (event->pair, parent_dir); fullpath = _ih_fullpath_from_event (event->pair, parent_dir);
other = g_file_new_for_path (fullpath); other = g_file_new_for_path (fullpath);
g_free (fullpath); g_free (fullpath);
@ -193,7 +191,6 @@ ih_event_callback (ik_event_t *event,
child, other, eflags); child, other, eflags);
g_object_unref (child); g_object_unref (child);
g_object_unref (parent);
if (other) if (other)
g_object_unref (other); g_object_unref (other);
} }
@ -204,11 +201,8 @@ ih_not_missing_callback (inotify_sub *sub)
gchar *fullpath; gchar *fullpath;
GFileMonitorEvent eflags; GFileMonitorEvent eflags;
guint32 mask; guint32 mask;
GFile* parent;
GFile* child; GFile* child;
parent = g_file_new_for_path (sub->dirname);
if (sub->filename) if (sub->filename)
{ {
fullpath = g_strdup_printf ("%s/%s", sub->dirname, sub->filename); fullpath = g_strdup_printf ("%s/%s", sub->dirname, sub->filename);
@ -234,7 +228,6 @@ ih_not_missing_callback (inotify_sub *sub)
child, NULL, eflags); child, NULL, eflags);
g_object_unref (child); g_object_unref (child);
g_object_unref (parent);
} }
/* Transforms a inotify event to a GVFS event. */ /* Transforms a inotify event to a GVFS event. */