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

Bug#172172: xlibs: memory leak in imExten.c:_XimExtension()



Package: xlibs
Version: 4.2.1-4
Severity: normal
Tags: patch upstream


-- System Information
Debian Release: testing/unstable
Kernel Version: Linux lissie 2.4.19 #1 Thu Aug 22 21:43:27 JST 2002 i686 unknown unknown GNU/Linux

Versions of the packages xlibs depends on:
hi  libfreetype6   2.1.2-10.local FreeType 2 font engine, shared library files
ii  libc6          2.3.1-5        GNU C Library: Shared libraries and Timezone
ii  xfree86-common 4.2.1-4        X Window System (XFree86) infrastructure


An buffer allocated at the biggining of imExten.c:_XimExtension()
seems to be never freed.

Since the file "imExten.c" have been not touched for a year in the upstream CVS,
I'd like to propose following patch.

regards,

minami <minami@chem.s.u-tokyo.ac.jp>


The file "imExten.c" have been not touched during a year in XFree86 CVS
--- imExten.c.old       2002-12-08 09:39:23.000000000 +0900
+++ imExten.c   2002-12-08 10:57:30.000000000 +0900
@@ -480,9 +480,12 @@
     len += sizeof(CARD16)              /* sizeof imid */
         + sizeof(INT16);               /* sizeof length of extensions */

-   _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len);
-    if (!(_XimWrite(im, len, (XPointer)buf)))
+    _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len);
+    if (!(_XimWrite(im, len, (XPointer)buf))) {
+       XFree(buf);
        return False;
+    }
+    XFree(buf);
     _XimFlush(im);
     buf_size = BUFSIZE;
     ret_code = _XimRead(im, &len, (XPointer)reply, buf_size,




Reply to: