summaryrefslogtreecommitdiff
path: root/hw/xfree86/modes
diff options
context:
space:
mode:
authorOliver McFadden <oliver.mcfadden@nokia.com>2009-07-16 18:50:22 +0300
committerOliver McFadden <oliver.mcfadden@nokia.com>2009-07-16 18:50:22 +0300
commit66eabbebaf1b40fed7670b7c05337ed6226dd81e (patch)
tree25b407eebfad416efe0a240be1eb163273ee9d84 /hw/xfree86/modes
parent464e8ad733fa6afee028607d6e7d4663b4c273cc (diff)
Coverity Prevent: RESOURCE_LEAK in xf86CrtcSetInitialGamma
Diffstat (limited to 'hw/xfree86/modes')
-rw-r--r--hw/xfree86/modes/xf86Crtc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 82e270312..c46b8260a 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2216,10 +2216,13 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
blue = green + size;
/* Only cause warning if user wanted gamma to be set. */
- if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0))
+ if (!crtc->funcs->gamma_set && (gamma_red != 1.0 || gamma_green != 1.0 || gamma_blue != 1.0)) {
+ free(red);
return FALSE;
- else if (!crtc->funcs->gamma_set)
+ } else if (!crtc->funcs->gamma_set) {
+ free(red);
return TRUE;
+ }
/* At this early stage none of the randr-interface stuff is up.
* So take the default gamma size for lack of something better.
@@ -2245,8 +2248,10 @@ xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green,
}
/* Default size is 256, so anything else is failure. */
- if (size != crtc->gamma_size)
+ if (size != crtc->gamma_size) {
+ free(red);
return FALSE;
+ }
crtc->gamma_size = size;
memcpy (crtc->gamma_red, red, crtc->gamma_size * sizeof (CARD16));