Don't forget to free resources in an early return
authorMatthias Clasen <mclasen@redhat.com>
Tue, 14 Jun 2011 14:07:22 +0000 (10:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 14 Jun 2011 14:07:22 +0000 (10:07 -0400)
gio/xdgmime/xdgmimemagic.c

index ae1093a..63e0bdd 100644 (file)
@@ -272,7 +272,10 @@ _xdg_mime_magic_parse_header (FILE *magic_file, XdgMimeMagicMatch *match)
 
   buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &end_of_file);
   if (end_of_file)
-    return XDG_MIME_MAGIC_EOF;
+    {
+      free (buffer);
+      return XDG_MIME_MAGIC_EOF;
+    }
 
   end_ptr = buffer;
   while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n')