Package: gjiten
Version: 2.6-1
Followup-For: Bug #445042

Hi,

Since I was already debugging for my bug (#445042), I also created a
patch for this bug.

It seems the kanji file is being cached in globals, but not correctly
reset when the window is closed. Again, I don't know for the other
globals... maybe more needs to be reset to NULL.

I also close the original file after the mmap() because it would leak
after this patch, and I hope I didn't trigger any other memleaks :)

John

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=nl_NL (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages gjiten depends on:
ii  edict                      2007.02.09-1  English / Japanese dictionary
ii  gconf2                     2.18.0.1-3    GNOME configuration database syste
ii  kanjidic                   2007.09.14-1  A Kanji Dictionary
ii  libart-2.0-2               2.3.19-3      Library of functions for 2D graphi
ii  libatk1.0-0                1.20.0-1      The ATK accessibility toolkit
ii  libbonobo2-0               2.18.0-2      Bonobo CORBA interfaces library
ii  libbonoboui2-0             2.20.0-1      The Bonobo UI library
ii  libc6                      2.6.1-2       GNU C Library: Shared libraries
ii  libcairo2                  1.4.10-1      The Cairo 2D vector graphics libra
ii  libfontconfig1             2.4.2-1.2     generic font configuration library
ii  libgconf2-4                2.18.0.1-3    GNOME configuration database syste
ii  libglade2-0                1:2.6.2-1     library to load .glade files at ru
ii  libglib2.0-0               2.14.0-2      The GLib library of C routines
ii  libgnome-keyring0          0.8.1-2       GNOME keyring services library
ii  libgnome2-0                2.18.0-4      The GNOME 2 library - runtime file
ii  libgnomecanvas2-0          2.14.0-3      A powerful object-oriented display
ii  libgnomeui-0               2.20.0-1      The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0             1:2.20.0-1    GNOME Virtual File System (runtime
ii  libgtk2.0-0                2.12.0-2      The GTK+ graphical user interface 
ii  libice6                    2:1.0.4-1     X11 Inter-Client Exchange library
ii  liborbit2                  1:2.14.7-0.1  libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0              1.18.2-1      Layout and rendering of internatio
ii  libpopt0                   1.10-3        lib for parsing cmdline parameters
ii  libsm6                     2:1.0.3-1+b1  X11 Session Management library
ii  libx11-6                   2:1.0.3-7     X11 client-side library
ii  libxcursor1                1:1.1.9-1     X cursor management library
ii  libxext6                   1:1.0.3-2     X11 miscellaneous extension librar
ii  libxfixes3                 1:4.0.3-2     X11 miscellaneous 'fixes' extensio
ii  libxi6                     2:1.1.3-1     X11 Input extension library
ii  libxinerama1               1:1.0.2-1     X11 Xinerama extension library
ii  libxml2                    2.6.30.dfsg-2 GNOME XML library
ii  libxrandr2                 2:1.2.2-1     X11 RandR extension library
ii  libxrender1                1:0.9.3-1     X Rendering Extension client libra

Versions of packages gjiten recommends:
ii  ttf-kochi-mincho        1.0.20030809-4   Kochi Subst Mincho Japanese TrueTy
ii  ttf-sazanami-mincho     0.0.1.20040629-3 Sazanami Mincho Japanese TrueType 

-- no debconf information
--- gjiten-2.6/src/kanjidic.c	2006-10-29 18:17:36.000000000 +0100
+++ gjiten-2.6.patched/src/kanjidic.c	2007-10-02 22:22:54.444053437 +0200
@@ -796,6 +796,7 @@
   }
   radkfile = (gchar *) mmap(NULL, radkfile_size, PROT_READ, MAP_SHARED, fd, 0);
   if (radkfile == NULL) gjiten_abort_with_msg("mmap() failed for radkfile\n");
+  close(fd);		// close the file to avoid leaking filedescriptors
 
   if (error == TRUE) {
 		gjiten_print_error(_("Error opening %s.\n "\
@@ -945,6 +946,9 @@
 	if (kanjiDic != NULL) {
 		KanjiDic *tmp;
 		radical_window_close();
+		if (radkfile)
+			munmap(radkfile, radkfile_size);
+		radkfile = NULL;
 
 		/* Avoid recursion */
 		tmp = kanjiDic;

Reply via email to