diff options
author | Keith Packard <keithp@keithp.com> | 2012-08-06 16:40:54 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-08-06 16:40:54 -0700 |
commit | 2100e72388a3dc174093d80c9723f021b4614d17 (patch) | |
tree | 940221b9426580993453c7a704f640699084374c /randr | |
parent | 4a6f42dda00ba3b5616f8a86f0d4c9a652c7d9d4 (diff) | |
parent | c37c65052f674cd58894ad0b9ec22928a62c624e (diff) |
Merge remote-tracking branch 'alanc/master'
Diffstat (limited to 'randr')
-rw-r--r-- | randr/rrmode.c | 4 | ||||
-rw-r--r-- | randr/rrproperty.c | 12 | ||||
-rw-r--r-- | randr/rrproviderproperty.c | 12 |
3 files changed, 23 insertions, 5 deletions
diff --git a/randr/rrmode.c b/randr/rrmode.c index 56e5977b5..f5d3f9e54 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -89,8 +89,10 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen) } mode->mode.id = FakeClientID(0); - if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) + if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) { + free(newModes); return NULL; + } modes = newModes; modes[num_modes++] = mode; diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 7f0909287..67b546728 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -217,6 +217,8 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, !pScrPriv->rrOutputSetProperty(output->pScreen, output, prop->propertyName, &new_value)) { free(new_value.data); + if (add) + RRDestroyOutputProperty(prop); return BadValue; } free(prop_value->data); @@ -342,12 +344,18 @@ RRConfigureOutputProperty(RROutputPtr output, Atom property, /* * ranges must have even number of values */ - if (range && (num_values & 1)) + if (range && (num_values & 1)) { + if (add) + RRDestroyOutputProperty(prop); return BadMatch; + } new_values = malloc(num_values * sizeof(INT32)); - if (!new_values && num_values) + if (!new_values && num_values) { + if (add) + RRDestroyOutputProperty(prop); return BadAlloc; + } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); diff --git a/randr/rrproviderproperty.c b/randr/rrproviderproperty.c index e0a814ff8..ab601da9a 100644 --- a/randr/rrproviderproperty.c +++ b/randr/rrproviderproperty.c @@ -216,6 +216,8 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, if (pending && pScrPriv->rrProviderSetProperty && !pScrPriv->rrProviderSetProperty(provider->pScreen, provider, prop->propertyName, &new_value)) { + if (add) + RRDestroyProviderProperty(prop); free(new_value.data); return BadValue; } @@ -342,12 +344,18 @@ RRConfigureProviderProperty(RRProviderPtr provider, Atom property, /* * ranges must have even number of values */ - if (range && (num_values & 1)) + if (range && (num_values & 1)) { + if (add) + RRDestroyProviderProperty(prop); return BadMatch; + } new_values = malloc(num_values * sizeof(INT32)); - if (!new_values && num_values) + if (!new_values && num_values) { + if (add) + RRDestroyProviderProperty(prop); return BadAlloc; + } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); |