From a7cb314b060f6ada855ec75b283ef64bf835824a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 21 Mar 2010 20:40:54 +0000 Subject: [PATCH] test/any2ppm: Check for errors after executing script. --- test/any2ppm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/any2ppm.c b/test/any2ppm.c index a7bb49a67..55b4c7ec7 100644 --- a/test/any2ppm.c +++ b/test/any2ppm.c @@ -273,11 +273,14 @@ _cairo_script_render_page (const char *filename, csi = cairo_script_interpreter_create (); cairo_script_interpreter_install_hooks (csi, &hooks); - cairo_script_interpreter_run (csi, filename); - status = cairo_script_interpreter_destroy (csi); - if (surface == NULL) { - return "cairo-script interpreter failed"; + status = cairo_script_interpreter_run (csi, filename); + if (status) { + cairo_surface_destroy (surface); + surface = NULL; } + status = cairo_script_interpreter_destroy (csi); + if (surface == NULL) + return "cairo-script interpreter failed"; if (status == CAIRO_STATUS_SUCCESS) status = cairo_surface_status (surface);