xserver/hw/xfree86/common
Alan Coopersmith c1c01e3508 Make xf86ValidateModes actually copy clock range list to screen pointer
Our in-house parfait 1.1 code analysis tool complained that every exit
path from xf86ValidateModes() in hw/xfree86/common/xf86Mode.c leaks the
storeClockRanges allocation made at line 1501 with XNFalloc.

Investigating, it seems that this code to copy the clock range list to
the clockRanges list in the screen pointer is just plain insane, and
according to git, has been since we first imported it from XFree86.

We start at line 1495 by walking the linked list from scrp->clockRanges
until we find the end.  But that was just a diversion, since we've found
the end and immediately forgotten it, and thus at 1499 we know that
storeClockRanges is NULL, but that's not a problem since we're going to
immediately overwrite that value as the first thing in the loop.

So we move on through this loop at 1499, which takes us through the
linked list from the clockRanges variable, and for every entry in
that list allocates a new structure and copies cp to it.  If we've
not filled in the screen's clockRanges pointer yet, we set it to
the first storeClockRanges we copied from cp.   Otherwise, as best
I can tell, we just drop it into memory and let it leak away, as
parfait warned.

And then we hit the loop action, which if we haven't hit the end of
the cp list, advances cp to the next item in the list, and then just
for the fun of it, also sets storeClockRanges to the ->next pointer it
has just copied from cp as well, even though it's going to overwrite
it as the very first instruction in the loop body.

v2: rewritten using nt_list_* macros from Xorg's list.h header

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-05 18:30:37 -08:00
..
.gitignore .gitignore: use common defaults with custom section #24239 2009-11-11 21:40:20 -08:00
Makefile.am Fix compilation of Xorg DDX without XF86VIDMODE 2012-10-11 12:54:11 +01:00
compiler.h Provide prototypes for Mmio functions for Solaris Studio on SPARC 2012-06-05 16:28:54 -07:00
dgaproc.h DGA: Remove excessive module-induced indirection 2012-07-09 23:40:55 -07:00
extramodes Remove some default modes that really shouldn't be in the default set. 2008-06-24 10:40:36 -04:00
fourcc.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
modeline2c.awk Remove some OS/2 leftovers. 2009-04-06 10:58:47 -04:00
vesamodes Fix standard VESA modes. 2006-11-03 14:06:32 -08:00
vidmodeproc.h Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xaarop.h xfree86: Drop some dead XAA decls from SDK headers 2012-07-25 14:03:31 -07:00
xf86.h xfree86: add xf86UpdateDesktopDimensions() 2012-10-08 12:40:49 +10:00
xf86AutoConfig.c xf86: include xf86platformBus.h in xf86AutoConfig.c 2012-07-12 19:23:42 -07:00
xf86Build.h.in Print the build time as well as the date if we can. 2007-06-04 02:03:44 -04:00
xf86Bus.c Merge remote-tracking branch 'ajax/ioperm' 2012-09-20 17:26:48 +02:00
xf86Bus.h xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86Config.c Move DRI2 from external module to built-in 2012-07-10 00:31:01 -07:00
xf86Config.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Configure.c xfree86: Change the semantics of driverFunc(GET_REQUIRED_HW_INTERFACES) 2012-09-20 11:07:27 -04:00
xf86Cursor.c xfree86: drop ddx-specific SIGIO blocking 2012-07-03 15:56:35 +10:00
xf86DGA.c xfree86: update the device state for all DGA events (#59100) 2013-01-11 14:57:40 +10:00
xf86DPMS.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86Events.c xfree86: don't access the old input handler after freeing it 2013-01-11 14:57:48 +10:00
xf86Extensions.c Constify extensions in LoadExtension users 2012-11-21 11:13:55 +11:00
xf86Extensions.h xf86: Re-export extension disable flags 2012-07-16 18:24:49 -07:00
xf86Globals.c xfree86: add autoAddGPU option (v2) 2012-07-06 10:35:20 +01:00
xf86Helper.c xfree86: add xf86UpdateDesktopDimensions() 2012-10-08 12:40:49 +10:00
xf86InPriv.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Init.c xfree86: Change the semantics of driverFunc(GET_REQUIRED_HW_INTERFACES) 2012-09-20 11:07:27 -04:00
xf86Mode.c Make xf86ValidateModes actually copy clock range list to screen pointer 2013-02-05 18:30:37 -08:00
xf86Module.h xf86: bump input ABI version to 19 2013-01-11 14:57:48 +10:00
xf86Opt.h Fix additional gcc -Wwrite-strings warning in xf86 ddx 2012-10-04 13:24:44 +10:00
xf86Option.c Fix two typos "requires an string value" 2013-01-11 14:57:32 +10:00
xf86Optionstr.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86PM.c xfree86: drop ddx-specific SIGIO blocking 2012-07-03 15:56:35 +10:00
xf86PciInfo.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86Priv.h xfree86: Change the semantics of driverFunc(GET_REQUIRED_HW_INTERFACES) 2012-09-20 11:07:27 -04:00
xf86Privstr.h xfree86: add autoAddGPU option (v2) 2012-07-06 10:35:20 +01:00
xf86RandR.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VGAarbiter.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VGAarbiter.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86VGAarbiterPriv.h api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86VidMode.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86Xinput.c xfree86: fix mouse wheel support for DGA clients 2012-05-23 16:06:27 +10:00
xf86Xinput.h xfree86: constify InputDriverPtr->driverName and default_options 2012-07-02 22:34:33 -07:00
xf86cmap.c Fix formatting of address operators 2012-12-05 18:09:48 -06:00
xf86cmap.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86fbBus.c xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86fbman.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86fbman.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86noBus.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86pciBus.c xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86pciBus.h xfree86: use udev to provide device enumeration for kms devices (v10) 2012-07-06 10:20:19 +01:00
xf86platformBus.c Revert "xf86: Fix non-PCI configuration-less setups" 2012-12-12 12:56:46 +10:00
xf86platformBus.h xfree86: add platform bus hotplug support (v3) 2012-07-06 10:35:20 +01:00
xf86sbusBus.c api: rework the X server driver API to avoid global arrays. 2012-06-05 13:22:18 +01:00
xf86sbusBus.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xf86str.h xf86: Fix build against recent Linux kernel 2012-10-19 13:12:33 +10:00
xf86vmode.c dix: Pull client-is-local flag up to the ClientRec 2012-09-20 14:36:39 -04:00
xf86xv.c Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xv.h Move Xv and XvMC from extmod to built-in 2012-07-09 23:28:37 -07:00
xf86xvmc.c Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xvmc.h Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xf86xvpriv.h xfree86: fix new warnings introduced in rebase. 2012-06-05 10:33:23 -07:00
xisb.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xisb.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xorgHelper.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xorgVersion.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00