Do not free() the buffer returned by localtime().  Also,
switch to calling localtime_r() which is re-entrant.

Signed-off-by: Joe Slater <joe.sla...@windriver.com>
---
 ...op-thumbnail-don-t-convert-time_t-to-long.patch | 27 +++++++++-------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git 
a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
 
b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
index c1a7d4f..be657a8 100644
--- 
a/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
+++ 
b/meta/recipes-gnome/gnome-desktop/gnome-desktop/gnome-desktop-thumbnail-don-t-convert-time_t-to-long.patch
@@ -9,12 +9,11 @@ build for X32, where long's size doesn't match that of time_t.
 Upstream-Status: Pending
 Signed-off-by: Christopher Larson <chris_lar...@mentor.com>
 
----
- libgnome-desktop/gnome-desktop-thumbnail.c | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
+Modified to use localtime_r() and not free() a static structure.
+
+Signed-off-by: Joe Slater <jsla...@windriver.com>
+
 
-diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c 
b/libgnome-desktop/gnome-desktop-thumbnail.c
-index e56c3d7..5d96bf3 100644
 --- a/libgnome-desktop/gnome-desktop-thumbnail.c
 +++ b/libgnome-desktop/gnome-desktop-thumbnail.c
 @@ -120,6 +120,8 @@
@@ -30,24 +29,23 @@ index e56c3d7..5d96bf3 100644
    char *tmp_path = NULL;
    int tmp_fd;
    char mtime_str[21];
-+  struct tm *tmp_mtime = NULL;
++  struct tm tmp_mtime;
    gboolean ret = FALSE;
    GError *error = NULL;
    const char *width, *height;
-@@ -1124,7 +1127,11 @@ save_thumbnail (GdkPixbuf  *pixbuf,
+@@ -1124,7 +1127,10 @@ save_thumbnail (GdkPixbuf  *pixbuf,
      goto out;
    close (tmp_fd);
  
 -  g_snprintf (mtime_str, 21, "%" G_GINT64_FORMAT, (gint64) mtime);
-+  tmp_mtime = localtime (&mtime);
-+  if (!tmp_mtime)
++  if (!localtime_r (&mtime,&tmp_mtime))
 +    goto out;
-+  strftime (mtime_str, 21, "%s", tmp_mtime);
-+  free (tmp_mtime);
++
++  strftime (mtime_str, 21, "%s", &tmp_mtime);
    width = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Width");
    height = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Image::Height");
  
-@@ -1319,6 +1326,7 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf          
*pixbuf,
+@@ -1319,6 +1325,7 @@ gnome_desktop_thumbnail_is_valid (GdkPix
  {
    const char *thumb_uri, *thumb_mtime_str;
    time_t thumb_mtime;
@@ -55,7 +53,7 @@ index e56c3d7..5d96bf3 100644
  
    thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI");
    if (g_strcmp0 (uri, thumb_uri) != 0)
-@@ -1327,7 +1335,11 @@ gnome_desktop_thumbnail_is_valid (GdkPixbuf          
*pixbuf,
+@@ -1327,7 +1334,11 @@ gnome_desktop_thumbnail_is_valid (GdkPix
    thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime");
    if (!thumb_mtime_str)
      return FALSE;
@@ -68,6 +66,3 @@ index e56c3d7..5d96bf3 100644
    if (mtime != thumb_mtime)
      return FALSE;
  
--- 
-2.14.1
-
-- 
2.7.4

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to