[PATCH 2/3] compositor: Attach only valid background buffers

Benjamin Franzke benjaminfranzke at googlemail.com
Sat Jan 15 03:34:49 PST 2011


If a background is not found,
create_buffer_from_png will return NULL.
Do not attach these buffers.
---
 compositor/compositor.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/compositor/compositor.c b/compositor/compositor.c
index 7261dc2..cd13e4d 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -309,6 +309,10 @@ background_create(struct wlsc_output *output, const char *filename)
 	buffer = create_buffer_from_png(output->compositor,
 					filename,
 					output->width, output->height);
+	if (buffer == NULL) {
+		free(background);
+		return NULL;
+	}
 	buffer->attach(buffer, &background->surface);
 
 	return background;
-- 
1.7.3.4



More information about the wayland-devel mailing list