From 6f6e8ea94e3f6e409efbfc1802a3f4872d85e7f0 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Mon, 21 Dec 2015 02:23:27 +0100 Subject: [PATCH] Check errors of cairo_image_surface_create properly Signed-off-by: Sebastian Ramacher --- zathura/print.c | 5 +++++ zathura/render.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/zathura/print.c b/zathura/print.c index ccd06c4..d144cfb 100644 --- a/zathura/print.c +++ b/zathura/print.c @@ -130,6 +130,11 @@ cb_print_draw_page(GtkPrintOperation* print_operation, GtkPrintContext* gtk_print_operation_cancel(print_operation); return; } + if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { + gtk_print_operation_cancel(print_operation); + cairo_surface_destroy(surface); + return; + } cairo_t* temp_cairo = cairo_create(surface); if (cairo == NULL) { diff --git a/zathura/render.c b/zathura/render.c index 7217183..f18ceb4 100644 --- a/zathura/render.c +++ b/zathura/render.c @@ -746,6 +746,10 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render if (surface == NULL) { return false; } + if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { + cairo_surface_destroy(surface); + return false; + } cairo_t* cairo = cairo_create(surface); if (cairo == NULL) {