diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-26 06:59:07 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-26 07:00:20 +0100 |
commit | 12a349974b63a47ad55384abe0d7a839af48f31a (patch) | |
tree | ba61ce507383881c672879c2c8bebb1e5b63070e | |
parent | 2ec2164ba4bd3a266949cdb379b6da1090475c08 (diff) |
sna: Make output destroy more defensive
We may never create the properties as it may be ignored or the
allocation may fail, so we need to be careful when freeing we do not
stumble over invalid pointers.
References: https://bugs.freedesktop.org/show_bug.cgi?id=80355#c28
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 799d7d47..166203a1 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2658,10 +2658,16 @@ sna_output_destroy(xf86OutputPtr output) free(sna_output->edid_raw); for (i = 0; i < sna_output->num_props; i++) { - if (output->randr_output) - RRDeleteOutputProperty(output->randr_output, sna_output->props[i].atoms[0]); + if (sna_output->props[i].kprop == NULL) + continue; + + if (sna_output->props[i].atoms) { + if (output->randr_output) + RRDeleteOutputProperty(output->randr_output, sna_output->props[i].atoms[0]); + free(sna_output->props[i].atoms); + } + drmModeFreeProperty(sna_output->props[i].kprop); - free(sna_output->props[i].atoms); } free(sna_output->props); free(sna_output->prop_ids); |