+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.
+
Fri Jun 10 20:57:42 2005 John Ellis <johne@verizon.net>
* exif.c (exif_parse_IFD_table): Fix offset count before testing
if (!exif_get_integer(exif, "Flash", &n)) return NULL;
/* Exif 2.1 only defines first 3 bits */
- if (n <= 0x07) return g_strdup(exif_text_list_find_value(ExifFlashList, n));
+ if (n <= 0x07) return exif_text_list_find_value(ExifFlashList, n);
/* must be Exif 2.2 */
string = g_string_new("");
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");
static ExifMarker marker = { 0x0200, EXIF_FORMAT_STRING, -1,
"Olympus.ShootingMode", "Shooting mode", NULL };
guint32 *array = item->data;
- const gchar *mode;
- const gchar *pdir = NULL;
+ gchar *mode;
+ gchar *pdir = NULL;
gchar *text;
gint l;
pdir = exif_text_list_find_value(OlympusPanoramaDirection, array[2]);
}
- text = g_strdup_printf("%s%s%s, seq %d", (mode) ? mode : "unknown",
+ text = g_strdup_printf("%s%s%s, seq %d", mode,
(pdir) ? " " : "", (pdir) ? pdir : "",
array[1] + 1);
l = strlen(text) + 1;
item = exif_item_new(marker.format, marker.tag, l, &marker);
memcpy(item->data, text, l);
+
g_free(text);
+ g_free(pdir);
+ g_free(mode);
exif->items = g_list_prepend(exif->items, item);
}
static ExifMarker marker = { 0x1015, EXIF_FORMAT_STRING, -1,
"Olympus.WhiteBalance", "White balance", NULL };
guint16 *array = item->data;
- const gchar *mode;
- const gchar *color = NULL;
+ gchar *mode;
+ gchar *color = NULL;
gchar *text;
gint l;
color = exif_text_list_find_value(OlympusWBColorTemp, array[1]);
}
- text = g_strdup_printf("%s%s%s", (mode) ? mode : "unknown",
+ text = g_strdup_printf("%s%s%s", mode,
(color) ? " " : "", (color) ? color : "");
l = strlen(text) + 1;
item = exif_item_new(marker.format, marker.tag, l, &marker);
memcpy(item->data, text, l);
+
g_free(text);
+ g_free(color);
+ g_free(mode);
exif->items = g_list_prepend(exif->items, item);
}