[PATCH weston 04/11] compositor-fbdev: Avoid dereferencing a pointer in freed memory

Rob Bradford robert.bradford at intel.com
Fri Jul 26 08:29:38 PDT 2013


From: Rob Bradford <rob at linux.intel.com>

fbdev_output_destroy will free the memory passed into in and since we
want to pass the device name into fbdev_output_create we need to save
this to an intermediate value
---
 src/compositor-fbdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 9c3d17e..36631f3 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -673,6 +673,7 @@ fbdev_output_reenable(struct fbdev_compositor *compositor,
 	struct fbdev_output *output = to_fbdev_output(base);
 	struct fbdev_screeninfo new_screen_info;
 	int fb_fd;
+	const char *device;
 
 	weston_log("Re-enabling fbdev output.\n");
 
@@ -697,8 +698,9 @@ fbdev_output_reenable(struct fbdev_compositor *compositor,
 		/* Remove and re-add the output so that resources depending on
 		 * the frame buffer X/Y resolution (such as the shadow buffer)
 		 * are re-initialised. */
+		device = output->device;
 		fbdev_output_destroy(base);
-		fbdev_output_create(compositor, output->device);
+		fbdev_output_create(compositor, device);
 
 		return 0;
 	}
-- 
1.8.3.1



More information about the wayland-devel mailing list