[MPlayer-users] bug report: mplayer libvo/x11_common.c leak

Pierre-Paul Lavoie ppl at nbnet.nb.ca
Wed Jan 1 15:18:02 CET 2003


Hi,

Please keep me CCed - I'm not on the list.

In line 95 of libvo/x11_common.c REV 1.126 (in function vo_hidecursor()):

 95  void vo_hidecursor ( Display *disp , Window win )
 96  {
 97          Cursor no_ptr;
 98          Pixmap bm_no;
 99          XColor black,dummy;
100          Colormap colormap;
101          static unsigned char bm_no_data[] = { 0,0,0,0, 0,0,0,0  };
102  
103          if(WinID==0) return;    // do not hide, if we're playing at root win
104          
105          colormap = DefaultColormap(disp,DefaultScreen(disp));
106          XAllocNamedColor(disp,colormap,"black",&black,&dummy);  
107          bm_no = XCreateBitmapFromData(disp, win, bm_no_data, 8,8);    
108          no_ptr=XCreatePixmapCursor(disp, bm_no, bm_no,&black, &black,0, 0);
109          XDefineCursor(disp,win,no_ptr);
110          XFreeCursor( disp,no_ptr );
111  }

Line 107 allocate without ever XFreePixmap()ing. The trivial fix
is to insert, between line 108-109, the following:

    if (bm_no != None)
        XFreePixmap(display, bm_no);

Here are the docs which I base my allegation on:

%man XCreateBitmapFromData
             .
             .
             .
       If insufficient working storage was allocated, XCre-
       ateBitmapFromData returns None.  It is your responsibility
       to free the bitmap using XFreePixmap when finished.
             .
             .
             .
%man XCreatePixmapCursor
             .
             .
             .
                  .   .   .              The pixmaps can be freed
       immediately if no further explicit references to them are
       to be made.                 .   .   .
             .
             .
             .
%exit


Have a good day, ppl.




More information about the MPlayer-users mailing list