Blob Blame History Raw
xawtv uses an idle callback to exit when a user requests it to exit. When xawtv
is blocked waiting for a video frame from a stuck video device, the user can
try to quit multiple times, which will lead to ExitCB getting called multiple
times, which leads to a double free error.

This patch protects ExitCB against being called twice. Also see:
https://bugzilla.redhat.com/show_bug.cgi?id=608344
diff -up xawtv-3.95/x11/xt.c~ xawtv-3.95/x11/xt.c
--- xawtv-3.95/x11/xt.c~	2010-11-17 10:37:53.000000000 +0100
+++ xawtv-3.95/x11/xt.c	2010-11-17 10:39:24.617724003 +0100
@@ -313,6 +313,12 @@ ExitWP(XtPointer client_data)
 void
 ExitCB(Widget widget, XtPointer client_data, XtPointer calldata)
 {
+    static int exit_pending = 0;
+
+    if (exit_pending)
+        return;
+
+    exit_pending = 1;
     audio_off();
     video_overlay(0);
     video_close();