From 65544d7add9aa3c7facc2df523e12f2d4163ea9b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 26 Jan 2018 15:31:10 +0000 Subject: Fix potential memory leak in CCodec_JpegModule::Start(). BUG=chromium:805881 Change-Id: I91266367296218998d011dd5f62e0b4c6df291a3 Reviewed-on: https://pdfium-review.googlesource.com/24070 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- core/fxcodec/codec/fx_codec_jpeg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 6e227ca20e..71a2f8889e 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -419,8 +419,10 @@ CJpegContext::~CJpegContext() { std::unique_ptr CCodec_JpegModule::Start() { // Use ordinary pointer until past the possibility of a longjump. auto* pContext = new CJpegContext(); - if (setjmp(pContext->m_JumpMark) == -1) + if (setjmp(pContext->m_JumpMark) == -1) { + delete pContext; return nullptr; + } jpeg_create_decompress(&pContext->m_Info); pContext->m_Info.src = &pContext->m_SrcMgr; -- cgit v1.2.3