Revision: 1760
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1760&view=rev
Author:   mow
Date:     2009-06-21 22:52:08 +0000 (Sun, 21 Jun 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/src/bar_exif.c
    trunk/src/exif.c

Modified: trunk/src/bar_exif.c
===================================================================
--- trunk/src/bar_exif.c        2009-06-21 20:14:53 UTC (rev 1759)
+++ trunk/src/bar_exif.c        2009-06-21 22:52:08 UTC (rev 1760)
@@ -494,9 +494,15 @@
                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);
                        ee->auto_title = FALSE;
                        }

Modified: trunk/src/exif.c
===================================================================
--- trunk/src/exif.c    2009-06-21 20:14:53 UTC (rev 1759)
+++ trunk/src/exif.c    2009-06-21 22:52:08 UTC (rev 1760)
@@ -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++;
        }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to