summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-10-13 11:04:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-10-13 11:04:02 +0100
commit8e7d6ddb9b485045b4662af83e048b06aab358aa (patch)
treed9855e059277ea8784204481e8b2d4de8bdf3185
parentf9a18c9f38d09c145eb513ca989966dc135c1e9b (diff)
sna: Cleanup allocation of sna_output after late syscall fail
If the second syscall fails (presumably as a deferred allocation failure check), cleanup the allocations made so far before reporting the failure. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 27a44672..547ebd8e 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2594,6 +2594,8 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
sna_output->prop_values = malloc(sizeof(uint64_t)*conn.count_props);
sna_output->dpms_mode = DPMSModeOff;
+ conn.count_encoders = 0;
+
conn.count_modes = 1;
conn.modes_ptr = (uintptr_t)&dummy;
@@ -2602,7 +2604,7 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
conn.prop_values_ptr = (uintptr_t)sna_output->prop_values;
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn))
- return false;
+ goto cleanup;
/* statically constructed property list */
assert(sna_output->num_props == conn.count_props);