[MPlayer-dev-eng] [PATCH] vo_vm_close() improper cleanup

Peter Kosinar goober at ksp.sk
Mon Nov 24 18:25:42 CET 2003


Hello developers!

The following information is based on my limited knowledge of this area,
so my conclusions may be wrong.  In such case, I'd like to ask you to
correct me.

*** libvo/x11_common.c:vo_vm_close() & vo_vm_switch()
vo_vm_close() calls free() on the global pointer vidmodes, but it
it doesn't set vidmodes to NULL, so if vo_vm_switch() is called
afterwards, it'll try to access the already-freed pointer (and this
will probably cause segfault). Also, it's unclear to me, why was
is XF86VidModeSwitchToMode() called twice in a row in vo_vm_close.
Fixed by removing the duplicate occurance and NULL-ing vidmodes.

Your sincerely,

Peter Kosinar
-------------- next part --------------
diff -Naur MPlayer-20031124/libvo/x11_common.c MPlayer-20031124-fixed/libvo/x11_common.c
--- MPlayer-20031124/libvo/x11_common.c	2003-09-24 09:38:57.000000000 +0200
+++ MPlayer-20031124-fixed/libvo/x11_common.c	2003-11-24 16:59:49.000000000 +0100
@@ -1364,8 +1364,7 @@
                }
 
            XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
-           XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
-           free(vidmodes);
+           free(vidmodes); vidmodes=NULL;
          }
 }
 #endif


More information about the MPlayer-dev-eng mailing list