Bug#420759: [Pkg-xfce-devel] Bug#420759: orageclock plugin leaks
memory
Simon Huggins
huggie at earth.li
Sat Apr 28 13:47:37 UTC 2007
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 at 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 at 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 at 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 at 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 at 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/
More information about the Pkg-xfce-devel
mailing list