diff --git a/src/mod/formats/mod_imagick/mod_imagick.c b/src/mod/formats/mod_imagick/mod_imagick.c index beb60387bf..5c185a5e44 100644 --- a/src/mod/formats/mod_imagick/mod_imagick.c +++ b/src/mod/formats/mod_imagick/mod_imagick.c @@ -384,6 +384,7 @@ static switch_status_t read_page(pdf_file_context_t *context) if (ret == MagickFalse && context->exception->severity != UndefinedException) { CatchException(context->exception); free(storage); + return SWITCH_STATUS_FALSE; } @@ -397,6 +398,8 @@ static switch_status_t read_page(pdf_file_context_t *context) if (ret == MagickFalse && context->exception->severity != UndefinedException) { CatchException(context->exception); + switch_img_free(&img); + return SWITCH_STATUS_FALSE; }