Debian Bug report logs - #420759
orageclock plugin leaks memory

version graph

Package: orage; Maintainer for orage is Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>; Source for orage is src:orage.

Reported by: Jason Kraftcheck <kraftche@cae.wisc.edu>

Date: Tue, 24 Apr 2007 14:36:06 UTC

Severity: grave

Tags: patch

Found in version orage/4.3.99.1-1

Fixed in versions orage/4.4.1-1, orage/4.3.99.1-2

Done: Simon Huggins <huggie@earth.li>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>:
Bug#420759; Package orage. Full text and rfc822 format available.

Acknowledgement sent to Jason Kraftcheck <kraftche@cae.wisc.edu>:
New Bug report received and forwarded. Copy sent to Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Jason Kraftcheck <kraftche@cae.wisc.edu>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: orageclock plugin leaks memory
Date: Tue, 24 Apr 2007 09:27:41 -0500
Package: orage
Version: 4.3.99.1-1
Severity: grave
Justification: renders package unusable


orageclock panel plugin in Debian stable leaks memory every time 
it updates the time.

--- orage-4.3.99.1/panel-plugin/orageclock.c	2006-09-02 10:55:11.000000000 -0500
+++ orage-mod/panel-plugin/orageclock.c	2007-04-18 15:59:20.000000000 -0500
@@ -96,9 +96,9 @@
     for (i = 0; i < OC_MAX_LINES; i++) {
         line = &clock->line[i];
         if (line->show) {
-            strftime(time_s, sizeof(time_s)
-                    , g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL)
-                    , &clock->now);
+            gchar* locstr = g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL);
+            strftime(time_s, sizeof(time_s), locstr, &clock->now); 
+            g_free(locstr);
             if (!g_utf8_validate(time_s, -1, NULL)) {
                 utf8time_s = g_locale_to_utf8(time_s, -1, NULL, NULL, NULL);
                 if (utf8time_s) {




-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages orage depends on:
ii  libatk1.0-0               1.12.4-3       The ATK accessibility toolkit
ii  libc6                     2.3.6.ds1-13   GNU C Library: Shared libraries
ii  libcairo2                 1.2.4-4        The Cairo 2D vector graphics libra
ii  libfontconfig1            2.4.2-1.2      generic font configuration library
ii  libfreetype6              2.2.1-5        FreeType 2 font engine, shared lib
ii  libglib2.0-0              2.12.4-2       The GLib library of C routines
ii  libgtk2.0-0               2.8.20-7       The GTK+ graphical user interface 
ii  libpango1.0-0             1.14.8-5       Layout and rendering of internatio
ii  libpng12-0                1.2.15~beta5-1 PNG library - runtime
ii  libx11-6                  2:1.0.3-7      X11 client-side library
ii  libxcursor1               1.1.7-4        X cursor management library
ii  libxext6                  1:1.0.1-2      X11 miscellaneous extension librar
ii  libxfce4mcs-client3       4.3.99.2-1     Client library for Xfce4 configure
ii  libxfce4util4             4.3.99.2-1     Utility functions library for Xfce
ii  libxfcegui4-4             4.3.99.2-1     Basic GUI C functions for Xfce4
ii  libxfixes3                1:4.0.1-5      X11 miscellaneous 'fixes' extensio
ii  libxi6                    1:1.0.1-4      X11 Input extension library
ii  libxinerama1              1:1.0.1-4.1    X11 Xinerama extension library
ii  libxrandr2                2:1.1.0.2-5    X11 RandR extension library
ii  libxrender1               1:0.9.1-3      X Rendering Extension client libra
ii  xfce4-panel               4.3.99.2-2     The Xfce4 desktop environment pane
ii  zlib1g                    1:1.2.3-13     compression library - runtime

orage recommends no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>:
Bug#420759; Package orage. Full text and rfc822 format available.

Acknowledgement sent to Simon Huggins <huggie@earth.li>:
Extra info received and forwarded to list. Copy sent to Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #10 received at 420759@bugs.debian.org (full text, mbox):

From: Simon Huggins <huggie@earth.li>
To: Jason Kraftcheck <kraftche@cae.wisc.edu>, 420759@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Re: [Pkg-xfce-devel] Bug#420759: orageclock plugin leaks memory
Date: Thu, 26 Apr 2007 15:46:19 +0100
fixed 420759 4.4.1-1
tags 420759 patch
thanks

On Tue, Apr 24, 2007 at 09:27:41AM -0500, Jason Kraftcheck wrote:
> orageclock panel plugin in Debian stable leaks memory every time 
> it updates the time.

> --- orage-4.3.99.1/panel-plugin/orageclock.c	2006-09-02 10:55:11.000000000 -0500
> +++ orage-mod/panel-plugin/orageclock.c	2007-04-18 15:59:20.000000000 -0500
> @@ -96,9 +96,9 @@
>      for (i = 0; i < OC_MAX_LINES; i++) {
>          line = &clock->line[i];
>          if (line->show) {
> -            strftime(time_s, sizeof(time_s)
> -                    , g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL)
> -                    , &clock->now);
> +            gchar* locstr = g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL);
> +            strftime(time_s, sizeof(time_s), locstr, &clock->now); 
> +            g_free(locstr);
>              if (!g_utf8_validate(time_s, -1, NULL)) {
>                  utf8time_s = g_locale_to_utf8(time_s, -1, NULL, NULL, NULL);
>                  if (utf8time_s) {

Upstream fixed this back in October in SVN.  We'll have to prepare a
version for proposed-updates I guess.

There is another use of g_locale_from_utf8 in a similarly bogus way just
before.

I've added this one in and used char *s as that's what future versions
of orage have used.

I end up with:
--- orage-4.3.99.1/panel-plugin/orageclock.c	2006-09-02 16:55:11.000000000 +0100
+++ orage-4.3.99.1-mod/panel-plugin/orageclock.c	2007-04-26 15:30:13.000000000 +0100
@@ -49,6 +49,7 @@
 {
     char date_s[255];
     char *utf8date = NULL;
+    char *tmp;
 
     /* TRANSLATORS: Use format characters from strftime(3)
      * to get the proper string for your locale.
@@ -59,9 +60,11 @@
      * %Y  : four digit year
      * %V  : ISO week number
      */
+    tmp = g_locale_from_utf8( _("%A %d %B %Y/%V"), -1, NULL, NULL, NULL);
     strftime(date_s, 255
-            , g_locale_from_utf8( _("%A %d %B %Y/%V"), -1, NULL, NULL, NULL)
+            , tmp
             , &clock->now);
+    g_free(tmp);
 
     /* Conversion to utf8 */
     if (!g_utf8_validate(date_s, -1, NULL)) {
@@ -89,6 +92,7 @@
     int     i;
     static gint mday = -1;
     ClockLine *line;
+    char *tmp;
 
     time(&t);
     localtime_r(&t, &clock->now);
@@ -96,9 +100,11 @@
     for (i = 0; i < OC_MAX_LINES; i++) {
         line = &clock->line[i];
         if (line->show) {
+            tmp = g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL);
             strftime(time_s, sizeof(time_s)
-                    , g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL)
+                    , tmp
                     , &clock->now);
+            g_free(tmp);
             if (!g_utf8_validate(time_s, -1, NULL)) {
                 utf8time_s = g_locale_to_utf8(time_s, -1, NULL, NULL, NULL);
                 if (utf8time_s) {


Does that look sane to you?

It builds at least.  I need to create a stable chroot and a stable
pbuilder environment to properly test it yet but if you could test it as
well that would help.

Simon

-- 
... "I know what I wrote Mulder. I also know that the laws of physics would
    permit the theoretical possibility of time travel but the limits of
    human endurance would prevent such a trip from ever happening"



Bug marked as fixed in version 4.4.1-1. Request was from Simon Huggins <huggie@earth.li> to control@bugs.debian.org. (Thu, 26 Apr 2007 14:48:02 GMT) Full text and rfc822 format available.

Tags added: patch Request was from Simon Huggins <huggie@earth.li> to control@bugs.debian.org. (Thu, 26 Apr 2007 14:48:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>:
Bug#420759; Package orage. Full text and rfc822 format available.

Acknowledgement sent to Jason Kraftcheck <kraftche@cae.wisc.edu>:
Extra info received and forwarded to list. Copy sent to Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #19 received at 420759@bugs.debian.org (full text, mbox):

From: Jason Kraftcheck <kraftche@cae.wisc.edu>
To: Simon Huggins <huggie@earth.li>
Cc: 420759@bugs.debian.org, control@bugs.debian.org
Subject: Re: [Pkg-xfce-devel] Bug#420759: orageclock plugin leaks memory
Date: Fri, 27 Apr 2007 12:50:07 -0500
Your patch seems to work fine.  Builds and runs w/ no problems.  After
about 24 hours, memory use (vsize) has remained around 1MB.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>:
Bug#420759; Package orage. Full text and rfc822 format available.

Acknowledgement sent to Simon Huggins <huggie@earth.li>:
Extra info received and forwarded to list. Copy sent to Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #24 received at 420759@bugs.debian.org (full text, mbox):

From: Simon Huggins <huggie@earth.li>
To: Jason Kraftcheck <kraftche@cae.wisc.edu>, 420759@bugs.debian.org
Subject: Re: Bug#420759: [Pkg-xfce-devel] Bug#420759: orageclock plugin leaks memory
Date: Sat, 28 Apr 2007 09:28:42 +0100
On Fri, Apr 27, 2007 at 12:50:07PM -0500, Jason Kraftcheck wrote:
> Your patch seems to work fine.  Builds and runs w/ no problems.  After
> about 24 hours, memory use (vsize) has remained around 1MB.

Hmm, do I really need to keep it running that long to notice?

I ran it for a short period in a stable chroot (the old version) and
didn't notice any change in memory usage in ps or top.

I can see from the code that the bug should exist but I'm wondering
about your config.

Do you have anything special in .config/xfce4/orage/oragerc ?

-- 
 _        huggie@earth.li      -+*+-     fou, con et anglais      _
(_)         "I'm gonna eat you, little fishy!" - The Cat         (_)
(_)                                                              (_)
  \___                                                        ___/



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>:
Bug#420759; Package orage. Full text and rfc822 format available.

Acknowledgement sent to Simon Huggins <huggie@earth.li>:
Extra info received and forwarded to list. Copy sent to Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #29 received at 420759@bugs.debian.org (full text, mbox):

From: Simon Huggins <huggie@earth.li>
To: Jason Kraftcheck <kraftche@cae.wisc.edu>, 420759@bugs.debian.org
Subject: Re: Bug#420759: [Pkg-xfce-devel] Bug#420759: orageclock plugin leaks memory
Date: Sat, 28 Apr 2007 14:47:37 +0100
On Sat, Apr 28, 2007 at 09:28:42AM +0100, Simon Huggins wrote:
> On Fri, Apr 27, 2007 at 12:50:07PM -0500, Jason Kraftcheck wrote:
> > Your patch seems to work fine.  Builds and runs w/ no problems.  After
> > about 24 hours, memory use (vsize) has remained around 1MB.
> Hmm, do I really need to keep it running that long to notice?

Never mind, got it :)

With the current version in etch:

huggie@shiny:~$ date && ps aux|grep orage\\clock
Sat Apr 28 08:32:59 UTC 2007
huggie   19601  0.0  0.4  61184  8432 tty1     S    08:31   0:00 /usr/lib/orage/xfce4/panel-plugins/orageclock socket_id 10485825 name orageclock id 11777089370 display_name Orage Clock size 36 screen_position 11
huggie@shiny:~$ date && ps aux|grep orage\\clock
Sat Apr 28 09:23:45 UTC 2007
huggie   19601  0.0  0.4  62208  9452 tty1     S    08:31   0:00 /usr/lib/orage/xfce4/panel-plugins/orageclock socket_id 10485825 name orageclock id 11777089370 display_name Orage Clock size 36 screen_position 11

So 61184 -> 62208 in 50 minutes.
(nothing else happened on the machine in the mean time)

With my patched version:
huggie@shiny:/$ date && ps aux|grep orage\\clock
Sat Apr 28 10:53:57 UTC 2007
huggie    6388  0.2  0.4  61188  8428 tty1     S    10:53   0:00 /usr/lib/orage/xfce4/panel-plugins/orageclock socket_id 12582977 name orageclock id 11777575670 display_name Orage Clock size 36 screen_position 11
huggie@shiny:/$ date && ps aux|grep orage\\clock
Sat Apr 28 13:31:16 UTC 2007
huggie    6388  0.0  0.4  61188  8428 tty1     S    10:53   0:00 /usr/lib/orage/xfce4/panel-plugins/orageclock socket_id 12582977 name orageclock id 11777575670 display_name Orage Clock size 36 screen_position 11

61188 -> 61188 



For reference the full diff in this version is (from debdiff):

diff -u orage-4.3.99.1/debian/changelog orage-4.3.99.1/debian/changelog
--- orage-4.3.99.1/debian/changelog
+++ orage-4.3.99.1/debian/changelog
@@ -1,3 +1,10 @@
+orage (4.3.99.1-2) stable; urgency=low
+
+  * Fix memory leak due to not freeing values returned from
+    g_locale_from_utf8 (thanks Jason Kraftcheck)                closes: #420759
+
+ -- Simon Huggins <huggie@earth.li>  Thu, 26 Apr 2007 15:31:34 +0100
+
 orage (4.3.99.1-1) unstable; urgency=low
 
   * New upstream release.
only in patch2:
unchanged:
--- orage-4.3.99.1.orig/panel-plugin/orageclock.c
+++ orage-4.3.99.1/panel-plugin/orageclock.c
@@ -49,6 +49,7 @@
 {
     char date_s[255];
     char *utf8date = NULL;
+    char *tmp;
 
     /* TRANSLATORS: Use format characters from strftime(3)
      * to get the proper string for your locale.
@@ -59,9 +60,11 @@
      * %Y  : four digit year
      * %V  : ISO week number
      */
+    tmp = g_locale_from_utf8( _("%A %d %B %Y/%V"), -1, NULL, NULL, NULL);
     strftime(date_s, 255
-            , g_locale_from_utf8( _("%A %d %B %Y/%V"), -1, NULL, NULL, NULL)
+            , tmp
             , &clock->now);
+    g_free(tmp);
 
     /* Conversion to utf8 */
     if (!g_utf8_validate(date_s, -1, NULL)) {
@@ -89,6 +92,7 @@
     int     i;
     static gint mday = -1;
     ClockLine *line;
+    char *tmp;
 
     time(&t);
     localtime_r(&t, &clock->now);
@@ -96,9 +100,11 @@
     for (i = 0; i < OC_MAX_LINES; i++) {
         line = &clock->line[i];
         if (line->show) {
+            tmp = g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL);
             strftime(time_s, sizeof(time_s)
-                    , g_locale_from_utf8(line->data->str, -1, NULL, NULL, NULL)
+                    , tmp
                     , &clock->now);
+            g_free(tmp);
             if (!g_utf8_validate(time_s, -1, NULL)) {
                 utf8time_s = g_locale_to_utf8(time_s, -1, NULL, NULL, NULL);
                 if (utf8time_s) {



I'll go away and talk to debian-release about including it in the next
point release of stable.

For other people experiencing this but I've put the debs at:
http://the.earth.li/~huggie/etch-orage-fix/

Simon.

-- 
oOoOo   Go not unto the Usenet for advice, for you will be told    oOoOo
 oOoOo  both yea and nay (and quite a few things that just have   oOoOo
  oOoOo         nothing at all to do with the question)          oOoOo
          htag.pl 0.0.22 ::::::: http://www.earth.li/~huggie/



Reply sent to Simon Huggins <huggie@earth.li>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Jason Kraftcheck <kraftche@cae.wisc.edu>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #34 received at 420759-close@bugs.debian.org (full text, mbox):

From: Simon Huggins <huggie@earth.li>
To: 420759-close@bugs.debian.org
Subject: Bug#420759: fixed in orage 4.3.99.1-2
Date: Tue, 15 May 2007 09:20:45 +0000
Source: orage
Source-Version: 4.3.99.1-2

We believe that the bug you reported is fixed in the latest version of
orage, which is due to be installed in the Debian FTP archive:

orage_4.3.99.1-2.diff.gz
  to pool/main/o/orage/orage_4.3.99.1-2.diff.gz
orage_4.3.99.1-2.dsc
  to pool/main/o/orage/orage_4.3.99.1-2.dsc
orage_4.3.99.1-2_amd64.deb
  to pool/main/o/orage/orage_4.3.99.1-2_amd64.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 420759@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Simon Huggins <huggie@earth.li> (supplier of updated orage package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Thu, 26 Apr 2007 15:31:34 +0100
Source: orage
Binary: orage
Architecture: source amd64
Version: 4.3.99.1-2
Distribution: stable
Urgency: low
Maintainer: Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>
Changed-By: Simon Huggins <huggie@earth.li>
Description: 
 orage      - Calendar for Xfce Desktop Environment
Closes: 420759
Changes: 
 orage (4.3.99.1-2) stable; urgency=low
 .
   * Fix memory leak due to not freeing values returned from
     g_locale_from_utf8 (thanks Jason Kraftcheck)                closes: #420759
Files: 
 77e83f2411caf48263cf038d98360b95 852 x11 optional orage_4.3.99.1-2.dsc
 5b71c78e14c0fa29fdd7e67437ff8595 10699 x11 optional orage_4.3.99.1-2.diff.gz
 2ba3d5e5e7aa2cfb6ee16db9612bfc7b 1174796 x11 optional orage_4.3.99.1-2_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFGOKjyMQdl+99c4rQRAtDoAKCAQtHwlotYUmYj/mkADWGB0LKFCQCgkQ5e
7+5Q9vHbbjc7w1PXnq6GiBI=
=DVgx
-----END PGP SIGNATURE-----




Reply sent to Simon Huggins <huggie@earth.li>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Jason Kraftcheck <kraftche@cae.wisc.edu>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #39 received at 420759-close@bugs.debian.org (full text, mbox):

From: Simon Huggins <huggie@earth.li>
To: 420759-close@bugs.debian.org
Subject: Bug#420759: fixed in orage 4.3.99.1-2
Date: Wed, 15 Aug 2007 22:39:30 +0000
Source: orage
Source-Version: 4.3.99.1-2

We believe that the bug you reported is fixed in the latest version of
orage, which is due to be installed in the Debian FTP archive:

orage_4.3.99.1-2.diff.gz
  to pool/main/o/orage/orage_4.3.99.1-2.diff.gz
orage_4.3.99.1-2.dsc
  to pool/main/o/orage/orage_4.3.99.1-2.dsc
orage_4.3.99.1-2_amd64.deb
  to pool/main/o/orage/orage_4.3.99.1-2_amd64.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 420759@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Simon Huggins <huggie@earth.li> (supplier of updated orage package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Thu, 26 Apr 2007 15:31:34 +0100
Source: orage
Binary: orage
Architecture: source amd64
Version: 4.3.99.1-2
Distribution: stable
Urgency: low
Maintainer: Debian Xfce Maintainers <pkg-xfce-devel@lists.alioth.debian.org>
Changed-By: Simon Huggins <huggie@earth.li>
Description: 
 orage      - Calendar for Xfce Desktop Environment
Closes: 420759
Changes: 
 orage (4.3.99.1-2) stable; urgency=low
 .
   * Fix memory leak due to not freeing values returned from
     g_locale_from_utf8 (thanks Jason Kraftcheck)                closes: #420759
Files: 
 77e83f2411caf48263cf038d98360b95 852 x11 optional orage_4.3.99.1-2.dsc
 5b71c78e14c0fa29fdd7e67437ff8595 10699 x11 optional orage_4.3.99.1-2.diff.gz
 2ba3d5e5e7aa2cfb6ee16db9612bfc7b 1174796 x11 optional orage_4.3.99.1-2_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFGOKjyMQdl+99c4rQRAtDoAKCAQtHwlotYUmYj/mkADWGB0LKFCQCgkQ5e
7+5Q9vHbbjc7w1PXnq6GiBI=
=DVgx
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Thu, 13 Sep 2007 07:30:46 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 16:38:51 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.