gnome-panel r11051 - trunk/applets/clock



Author: vuntz
Date: Fri Apr 11 10:32:12 2008
New Revision: 11051
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11051&view=rev

Log:
2008-04-11  Vincent Untz  <vuntz gnome org>

	* system-timezone.c: (recursive_compare): handle the case where the
	found file is /usr/share/zoneinfo/posix/Europe/Paris (ie, strip the
	"posix/" too)
	(system_timezone_read_etc_localtime_content): plug leak


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/system-timezone.c

Modified: trunk/applets/clock/system-timezone.c
==============================================================================
--- trunk/applets/clock/system-timezone.c	(original)
+++ trunk/applets/clock/system-timezone.c	Fri Apr 11 10:32:12 2008
@@ -636,9 +636,20 @@
                                   &file_stat,
                                   localtime_content,
                                   localtime_content_len,
-                                  file))
-                        return g_strdup (file + strlen (SYSTEM_ZONEINFODIR"/"));
-                else
+                                  file)) {
+                        int skip;
+
+                        g_assert (g_str_has_prefix (file,
+                                                    SYSTEM_ZONEINFODIR"/"));
+
+                        if (g_str_has_prefix (file,
+                                              SYSTEM_ZONEINFODIR"/posix/"))
+                                skip = strlen (SYSTEM_ZONEINFODIR"/posix/");
+                        else
+                                skip = strlen (SYSTEM_ZONEINFODIR"/");
+
+                        return g_strdup (file + skip);
+                } else
                         return NULL;
         } else if (S_ISDIR (file_stat.st_mode)) {
                 GDir       *dir = NULL;
@@ -741,6 +752,7 @@
         struct stat   stat_localtime;
         char         *localtime_content = NULL;
         unsigned int  localtime_content_len = -1;
+        char         *retval;
 
         if (g_stat (ETC_LOCALTIME, &stat_localtime) != 0)
                 return NULL;
@@ -754,11 +766,15 @@
                                   NULL))
                 return NULL;
 
-        return recursive_compare (&stat_localtime,
-                                  localtime_content,
-                                  localtime_content_len,
-                                  SYSTEM_ZONEINFODIR,
-                                  files_are_identical_content);
+        retval = recursive_compare (&stat_localtime,
+                                   localtime_content,
+                                   localtime_content_len,
+                                   SYSTEM_ZONEINFODIR,
+                                   files_are_identical_content);
+
+        g_free (localtime_content);
+
+        return retval;
 }
 
 typedef char * (*GetSystemTimezone) (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]