metadata: don't dereference the pointer before the validity check
authorStefan Kost <ensonic@users.sf.net>
Mon, 20 Jul 2009 13:19:40 +0000 (16:19 +0300)
committerStefan Kost <ensonic@users.sf.net>
Mon, 20 Jul 2009 13:42:43 +0000 (16:42 +0300)
ext/metadata/metadataexif.c

index cbdbf30d44686498d0061cbbb8fa75b03a5014b8..1fb97d58bd32ff063e5c43139848dfba49ee2d4d 100644 (file)
@@ -556,11 +556,13 @@ metadataparse_exif_content_foreach_entry_func (ExifEntry * entry,
   MEUserData *meudata = (MEUserData *) user_data;
   GType type = G_TYPE_NONE;
   ExifByteOrder byte_order;
-  const gchar *tag = metadataparse_exif_get_tag_from_exif (entry->tag, &type);
+  const gchar *tag;
 
   /* We need the byte order */
   if (!entry || !entry->parent || !entry->parent->parent)
     return;
+
+  tag = metadataparse_exif_get_tag_from_exif (entry->tag, &type);
   byte_order = exif_data_get_byte_order (entry->parent->parent);
 
   if (metadataparse_handle_unit_tags (entry, meudata, byte_order))