aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-08-14 14:59:48 +0200
committerDominique Martinet <asmadeus@codewreck.org>2017-08-14 15:05:45 +0200
commitdb77530a35f1adbd66f567d733b55a57a62304d8 (patch)
tree0b05c74f83f1bdb0956c94e6e9631584cd4f99ed
parent9a9dd15d5f5d401423c913558c3c5c5c5f1f0549 (diff)
Fix output destory: impl->destroy must be called last + obvious double-free
-rw-r--r--types/wlr_output.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 04dcbfa5..b4618194 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -178,13 +178,16 @@ void wlr_output_destroy(struct wlr_output *output) {
wlr_texture_destroy(output->cursor.texture);
wlr_renderer_destroy(output->cursor.renderer);
- output->impl->destroy(output);
for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
struct wlr_output_mode *mode = output->modes->items[i];
free(mode);
- free(mode);
}
list_free(output->modes);
+ if (output->impl->destroy) {
+ output->impl->destroy(output);
+ } else {
+ free(output);
+ }
}
void wlr_output_effective_resolution(struct wlr_output *output,