diff src/format_nikon.c @ 58:df73b94154e4

Sat Jun 11 01:06:49 2005 John Ellis <johne@verizon.net> * exif.c, format_nikon.c, format_olympus.c: Fix memory leaks, exif_text_list_find_value() will always return newly allocated text.
author gqview
date Sat, 11 Jun 2005 05:11:39 +0000
parents a8c9992320f4
children 71e1ebee420e
line wrap: on
line diff
--- a/src/format_nikon.c	Sat Jun 11 01:09:30 2005 +0000
+++ b/src/format_nikon.c	Sat Jun 11 05:11:39 2005 +0000
@@ -399,19 +399,18 @@
 		static ExifMarker marker = { 0x0088, EXIF_FORMAT_STRING, -1,
 					     "Nikon.AutoFocusPoint", "Auto focus point", NULL };
 		guchar *array = item->data;
-		const gchar *text;
+		gchar *text;
+		gint l;
 
 		text = exif_text_list_find_value(NikonAFPoint, (gint)array[1]);
-		if (text)
-			{
-			gint l;
+		l = strlen(text) + 1;
 
-			l = strlen(text) + 1;
-			item = exif_item_new(marker.format, marker.tag, l, &marker);
-			memcpy(item->data, text, l);
+		item = exif_item_new(marker.format, marker.tag, l, &marker);
+		memcpy(item->data, text, l);
 
-			exif->items = g_list_prepend(exif->items, item);
-			}
+		g_free(text);
+
+		exif->items = g_list_prepend(exif->items, item);
 		}
 
 	item = exif_get_item(exif, "Nikon.ISOSpeed");