[PATCH:libXxf86vm 1/4] Improve error handling in XF86VidModeGetMonitor()
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Apr 14 08:16:27 PDT 2013
On 04/14/13 04:28 AM, walter harms wrote:
> if (rep.vendorLength) {
> - if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) {
> - _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
> - ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
> - return False;
> - }
> + monitor->vendor = Xcalloc(rep.vendorLength + 1, 1);
> + if (monitor->vendor == NULL)
> + result = False;
> } else {
> monitor->vendor = NULL;
> }
>
> i do not understand this, do you realy want monitor->vendor = NULL;
> when monitor->vendor = Xcalloc(rep.vendorLength + 1, 1); succeeds ?`
You're missing the nesting there - the monitor->vendor = NULL; is the
else clause for if (rep.vendorLength) - i.e. if the length is 0, set
it to NULL, otherwise try to allocate memory for it.
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
More information about the xorg-devel
mailing list