# HG changeset patch # User mow # Date 1245624728 0 # Node ID 13ff1db545f635557adc1b1b6098aa9dfeffe172 # Parent da8afd03152fb4ed28e2d73abb9210f586c1ea37 Fix two memory failures 1. if the description field for a exif information is empty the program dumps core when trying to change this. The reason is a strcmp with a NULL value. The fix add the small functionality to set the field to default when it is set empty. 2. There was a g_strdup miss in exif.c which could end in memory corruption. diff -r da8afd03152f -r 13ff1db545f6 src/bar_exif.c --- a/src/bar_exif.c Sun Jun 21 20:14:53 2009 +0000 +++ b/src/bar_exif.c Sun Jun 21 22:52:08 2009 +0000 @@ -494,7 +494,13 @@ g_free(ee->key); ee->key = g_strdup(gtk_entry_get_text(GTK_ENTRY(cdd->key_entry))); title = gtk_entry_get_text(GTK_ENTRY(cdd->title_entry)); - if (strcmp(ee->title, title) != 0) + if (!title || strlen(title) == 0) + { + g_free(ee->title); + ee->title = exif_get_description_by_key(ee->key); + ee->auto_title = TRUE; + } + else if (!ee->title || strcmp(ee->title, title) != 0) { g_free(ee->title); ee->title = g_strdup(title); diff -r da8afd03152f -r 13ff1db545f6 src/exif.c --- a/src/exif.c Sun Jun 21 20:14:53 2009 +0000 +++ b/src/exif.c Sun Jun 21 22:52:08 2009 +0000 @@ -1516,7 +1516,7 @@ i = 0; while (ExifKnownGPSInfoMarkersList[i].tag > 0) { - if (strcmp(key, ExifKnownGPSInfoMarkersList[i].key) == 0) return _(ExifKnownGPSInfoMarkersList[i].description); + if (strcmp(key, ExifKnownGPSInfoMarkersList[i].key) == 0) return g_strdup(_(ExifKnownGPSInfoMarkersList[i].description)); i++; }