From 7e7ae7e5c8f157e82e26ec47ddd3f30fda80f8d4 Mon Sep 17 00:00:00 2001 From: Cristy Date: Wed, 30 Mar 2016 10:29:30 -0400 Subject: [PATCH] Eliminate hang when clearing the image stack --- MagickWand/magick-cli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MagickWand/magick-cli.c b/MagickWand/magick-cli.c index 3086dcf08..b4ad33bde 100644 --- a/MagickWand/magick-cli.c +++ b/MagickWand/magick-cli.c @@ -796,9 +796,11 @@ Magick_Command_Cleanup: /* recover original image_info and clean up stacks FUTURE: "-reset stacks" option */ - while (cli_wand->image_list_stack != (Stack *) NULL) + while ((cli_wand->image_list_stack != (Stack *) NULL) && + (cli_wand->image_list_stack->next != (Stack *) NULL)) CLIOption(cli_wand,")"); - while (cli_wand->image_info_stack != (Stack *) NULL) + while ((cli_wand->image_info_stack != (Stack *) NULL) && + (cli_wand->image_info_stack->next != (Stack *) NULL)) CLIOption(cli_wand,"}"); /* assert we have recovered the original structures */ -- 2.40.0