Fixed leak bug of GIOChannel.
[cascardo/atompub.git] / backend / files / giochannel.c
index 07f5934..94f8e77 100644 (file)
@@ -50,9 +50,11 @@ Atom * giochannel_atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
   if (g_io_channel_read_to_end (channel, &data, &len, &error) !=
       G_IO_STATUS_NORMAL)
     {
+      g_io_channel_unref (channel);
       atom_error_set (ctx, error);
       return NULL;
     }
+  g_io_channel_unref (channel);
   atom = atom_new_data_len (data, len);
   g_free (data);
   return atom;