Does not unref a GFile when creating an Atom, do it in the caller
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 9 Aug 2008 06:01:36 +0000 (03:01 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sat, 9 Aug 2008 08:34:39 +0000 (05:34 -0300)
backend/gio/gio.c

index a8b3fab..a6651f6 100644 (file)
@@ -45,12 +45,10 @@ gio_file_to_atom (AtomCtx *ctx, GFile *file)
   if (!g_file_load_contents (file, NULL, &data, &len, NULL, &error))
     {
       AtomError *aerr = atom_error_new_from_gerror (error);
-      g_object_unref (file);
       atom_error_set (ctx, aerr);
       g_error_free (error);
       return NULL;
     }
-  g_object_unref (file);
   atom = atom_entry_new_data_len (data, len);
   g_free (data);
   return atom;
@@ -60,8 +58,11 @@ static Atom *
 gio_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
 {
   GFile *file;
+  Atom *atom;
   file = gio_iri_to_file (ctx, iri);
-  return gio_file_to_atom (ctx, file);
+  atom = gio_file_to_atom (ctx, file);
+  g_object_unref (file);
+  return atom;
 }
 
 AtomBackend *