xserver: Branch 'master' - 9 commits

Peter Hutterer whot at kemper.freedesktop.org
Sun Sep 20 03:57:40 PDT 2009


 dix/devices.c                  |   13 -------------
 dix/getevents.c                |   24 ------------------------
 hw/xfree86/common/xf86Config.c |   10 +++++++---
 hw/xfree86/common/xf86Init.c   |    4 +++-
 hw/xfree86/common/xf86Xinput.c |    9 ---------
 hw/xfree86/common/xf86pciBus.c |    3 ++-
 hw/xfree86/loader/loadext.c    |    2 ++
 hw/xfree86/modes/xf86Crtc.c    |    4 +++-
 include/input.h                |    3 ---
 mi/mi.h                        |    4 +---
 mi/mieq.c                      |   21 +++++++++++++--------
 randr/randr.c                  |    2 ++
 randr/rrproperty.c             |    2 ++
 13 files changed, 35 insertions(+), 66 deletions(-)

New commits:
commit 2df10a49867635c341b1d1a9faadf4dbae043a0f
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:38 2009 -0700

    RRDestroyOutputProperty: Free randr property valid values
    
    These were leaked when the property was destroyed.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 6187b85..146facb 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -126,6 +126,8 @@ RRDestroyOutputProperty (RRPropertyPtr prop)
 	xfree(prop->current.data);
     if (prop->pending.data)
 	xfree(prop->pending.data);
+    if (prop->valid_values)
+	xfree(prop->valid_values);
     xfree(prop);
 }
 
commit d3a84906c00b8fe4a4e33fa89bff3ed66ceafdec
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:37 2009 -0700

    Free randr crtc and output pointer arrays
    
    All of the crts and outputs were freed, but not the arrays full of
    pointers to them.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/randr/randr.c b/randr/randr.c
index 1c1d0c4..5944564 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -98,6 +98,8 @@ RRCloseScreen (int i, ScreenPtr pScreen)
     for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
 	RROutputDestroy (pScrPriv->outputs[j]);
     
+    xfree (pScrPriv->crtcs);
+    xfree (pScrPriv->outputs);
     xfree (pScrPriv);
     RRNScreens -= 1;	/* ok, one fewer screen with RandR running */
     return (*pScreen->CloseScreen) (i, pScreen);    
commit 6086a6065666fb9ded5d99919ddfa51c66b76246
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:36 2009 -0700

    xf8CrtcSetModeTransform: free adjusted_mode name too
    
    The adjusted mode was freed, but any name allocated for that was leaked.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 8d636af..c6dfd8c 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -384,7 +384,9 @@ done:
 	crtc->transformPresent = saved_transform_present;
     }
 
-    free(adjusted_mode);
+    if (adjusted_mode->name)
+	    xfree(adjusted_mode->name);
+    xfree(adjusted_mode);
 
     if (didLock)
 	crtc->funcs->unlock (crtc);
commit 088107827347cee05a6e5317bcebdbc282b9a3bc
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:35 2009 -0700

    LoaderSortExtensions: free graph nodes
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/loader/loadext.c b/hw/xfree86/loader/loadext.c
index a61b28c..29cdaf1 100644
--- a/hw/xfree86/loader/loadext.c
+++ b/hw/xfree86/loader/loadext.c
@@ -430,6 +430,8 @@ LoaderSortExtensions(void)
     }
     if (sorted)
 	free_nodes(sorted);
+    if (graph)
+	free_nodes(graph);
     newList[i].name = NULL;
     xfree(ExtensionModuleList);
     ExtensionModuleList = newList;
commit d5959d37cd36895898786e4ea5bf72c480b79832
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:34 2009 -0700

    Free libpciaccess iterator in xf86PciProbe
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index df62e07..ac018e7 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -124,7 +124,7 @@ xf86PciProbe(void)
 	    info->user_data = 0;
 	}
     }
-
+    free(iter);
 
     /* If we haven't found a primary device try a different heuristic */
     if (primaryBus.type == BUS_NONE && num) {
@@ -212,6 +212,7 @@ xf86PciProbe(void)
 
 	xf86ErrorF("\n");
     }
+    xfree(xf86PciVideoInfo);
 }
 
 /*
commit ded35b7bf7a5ad27de152476c657a56a4f232800
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:33 2009 -0700

    xf86Xinput.c: get DIX event queue pointer once at InitInput time
    
    The DIX event queue is allocated before InitInput is called, so fetch
    the pointer there and not randomly at other times. This avoids failing
    to fetch the pointer sometimes during server regen and then smashing
    memory through the stale pointer from the previous server generation.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 1242de9..c9baff3 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1112,6 +1112,8 @@ InitInput(int argc, char **argv)
 
     mieqInit();
 
+    GetEventList(&xf86Events);
+
     /* Call the PreInit function for each input device instance. */
     for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
         /* Replace obsolete keyboard driver with kbd */
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 974b30e..b369537 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -283,11 +283,6 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
 
     /* Backwards compatibility. */
     local->history_size = GetMotionHistorySize();
-    /* Preallocate xEvent store */
-    if (!xf86Events)
-        GetEventList(&xf86Events);
-    if (!xf86Events)
-        FatalError("Couldn't allocate event store\n");
 }
 
 /***********************************************************************
@@ -769,7 +764,6 @@ xf86PostMotionEventP(DeviceIntPtr	device,
     }
 #endif
 
-    GetEventList(&xf86Events);
     nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
                                flags, first_valuator, num_valuators,
                                valuators);
@@ -819,7 +813,6 @@ xf86PostProximityEventP(DeviceIntPtr	device,
 
     XI_VERIFY_VALUATORS(num_valuators);
 
-    GetEventList(&xf86Events);
     nevents = GetProximityEvents(xf86Events, device,
                                  is_in ? ProximityIn : ProximityOut, 
                                  first_valuator, num_valuators, valuators);
@@ -881,7 +874,6 @@ xf86PostButtonEventP(DeviceIntPtr	device,
     }
 #endif
 
-    GetEventList(&xf86Events);
     nevents = GetPointerEvents(xf86Events, device,
                                is_down ? ButtonPress : ButtonRelease, button,
                                flags, first_valuator, num_valuators, valuators);
@@ -940,7 +932,6 @@ xf86PostKeyEventP(DeviceIntPtr	device,
     XI_VERIFY_VALUATORS(num_valuators);
 
     if (is_absolute) {
-        GetEventList(&xf86Events);
         nevents = GetKeyboardValuatorEvents(xf86Events, device,
                                             is_down ? KeyPress : KeyRelease,
                                             key_code, first_valuator,
commit 54f15a414130f89832b5c2604b0b44e7e4c6709f
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:32 2009 -0700

    probe_devices_from_device_sections: don't leak list of devices
    
    xf86MatchDevice returned malloc'd storage containing the list of
    devices to look at; make sure that gets freed.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 8f2cdf6..1242de9 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -439,7 +439,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
 	    }
 	}
     }
-
+    xfree(devList);
 
     return foundScreen;
 }
commit 8b5086250aa5dae8de8b763408ff480d7beac819
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 17 18:14:31 2009 -0700

    Eliminate bogus event resizing.
    
    Now that all event queues hold internal events only, they never need
    to be resized. Resizing them led to memory corruption as they would
    get sized for an appropriate xEvent, not an internal event.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/devices.c b/dix/devices.c
index 62574f2..e86e606 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -281,9 +281,6 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
     DeviceIntPtr *prev;
     int ret;
     DeviceIntPtr other;
-    int evsize  = sizeof(xEvent);
-    int listlen;
-    EventListPtr evlist;
     BOOL enabled;
     int flags[MAXDEVICES] = {0};
 
@@ -325,16 +322,6 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
      * list's events have enough memory for a ClassesChangedEvent from the
      * device
      */
-
-    evsize += SizeDeviceClasses(dev);
-
-    listlen = GetEventList(&evlist);
-    OsBlockSignals();
-    SetMinimumEventSize(evlist, listlen, evsize);
-    mieqResizeEvents(evsize);
-    OsReleaseSignals();
-
-
     if ((*prev != dev) || !dev->inited ||
 	((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) {
         ErrorF("[dix] couldn't enable device %d\n", dev->id);
diff --git a/dix/getevents.c b/dix/getevents.c
index 46e5080..7ddf88b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -964,30 +964,6 @@ InitEventList(int num_events)
 }
 
 /**
- * Allocs min_size memory for each event in the list.
- */
-void
-SetMinimumEventSize(EventListPtr list, int num_events, int min_size)
-{
-    if (!list)
-        return;
-
-    while(num_events--)
-    {
-        if (list[num_events].evlen < min_size)
-        {
-            list[num_events].evlen = min_size;
-            list[num_events].event = realloc(list[num_events].event, min_size);
-            if (!list[num_events].event)
-            {
-                FatalError("[dix] Failed to set event list's "
-                        "min_size to %d.\n", min_size);
-            }
-        }
-    }
-}
-
-/**
  * Free an event list.
  *
  * @param list The list to be freed.
diff --git a/include/input.h b/include/input.h
index 0e5b0bf..afcc006 100644
--- a/include/input.h
+++ b/include/input.h
@@ -409,9 +409,6 @@ extern _X_EXPORT int GetMaximumEventsNum(void);
 
 extern _X_EXPORT int GetEventList(EventListPtr* list);
 extern _X_EXPORT EventListPtr InitEventList(int num_events);
-extern _X_EXPORT void SetMinimumEventSize(EventListPtr list,
-                                int num_events,
-                                int min_size);
 extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events);
 
 extern void CreateClassesChangedEvent(EventListPtr event,
diff --git a/mi/mi.h b/mi/mi.h
index 3db8bfc..812edce 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -196,9 +196,7 @@ extern _X_EXPORT Bool mieqInit(
     void
 );
 
-extern _X_EXPORT void mieqResizeEvents(
-    int /* min_size */
-);
+extern _X_EXPORT void mieqFini(void);
 
 extern _X_EXPORT void mieqEnqueue(
     DeviceIntPtr /*pDev*/,
diff --git a/mi/mieq.c b/mi/mieq.c
index 1b81e4d..0b64882 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -110,24 +110,29 @@ mieqInit(void)
         miEventQueue.handlers[i] = NULL;
     for (i = 0; i < QUEUE_SIZE; i++)
     {
-        EventListPtr evlist = InitEventList(1);
-        if (!evlist)
-            FatalError("Could not allocate event queue.\n");
-        miEventQueue.events[i].events = evlist;
+	if (miEventQueue.events[i].events == NULL) {
+	    EventListPtr evlist = InitEventList(1);
+	    if (!evlist)
+		FatalError("Could not allocate event queue.\n");
+	    miEventQueue.events[i].events = evlist;
+	}
     }
 
     SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
     return TRUE;
 }
 
-/* Ensure all events in the EQ are at least size bytes. */
 void
-mieqResizeEvents(int min_size)
+mieqFini(void)
 {
     int i;
-
     for (i = 0; i < QUEUE_SIZE; i++)
-        SetMinimumEventSize(miEventQueue.events[i].events, 1, min_size);
+    {
+	if (miEventQueue.events[i].events != NULL) {
+	    FreeEventList(miEventQueue.events[i].events, 1);
+	    miEventQueue.events[i].events = NULL;
+	}
+    }
 }
 
 /*
commit c7987660fd665f32406b14db7078a3f5f7b76e9c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Sep 17 15:33:19 2009 +1000

    xfree86: fix up wrong use of OptionRec for AutoAddDevices andAutoEnableDevices
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index f5dc9f4..40f65bd 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -710,7 +710,11 @@ typedef enum {
     FLAG_DRI2,
     FLAG_USE_SIGIO
 } FlagValues;
-   
+
+/**
+ * NOTE: the last value for each entry is NOT the default. It is set to TRUE
+ * if the parser found the option in the config file.
+ */
 static OptionInfoRec FlagOptions[] = {
   { FLAG_NOTRAPSIGNALS,		"NoTrapSignals",		OPTV_BOOLEAN,
 	{0}, FALSE },
@@ -759,9 +763,9 @@ static OptionInfoRec FlagOptions[] = {
   { FLAG_USE_DEFAULT_FONT_PATH,  "UseDefaultFontPath",		OPTV_BOOLEAN,
 	{0}, FALSE },
   { FLAG_AUTO_ADD_DEVICES,       "AutoAddDevices",		OPTV_BOOLEAN,
-        {0}, TRUE },
+        {0}, FALSE },
   { FLAG_AUTO_ENABLE_DEVICES,    "AutoEnableDevices",		OPTV_BOOLEAN,
-        {0}, TRUE },
+        {0}, FALSE },
   { FLAG_GLX_VISUALS,		"GlxVisuals",			OPTV_STRING,
         {0}, FALSE },
   { FLAG_DRI2,			"DRI2",				OPTV_BOOLEAN,


More information about the xorg-commit mailing list