summaryrefslogtreecommitdiff
path: root/core/fxcodec
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-01-26 15:31:10 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-26 15:31:10 +0000
commit65544d7add9aa3c7facc2df523e12f2d4163ea9b (patch)
tree3ec239513542f57c47aeef88ab5901a2cd52dfa5 /core/fxcodec
parent7694f7ec6f53a55679a50130c1b12b2735289213 (diff)
downloadpdfium-65544d7add9aa3c7facc2df523e12f2d4163ea9b.tar.xz
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 <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec')
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp4
1 files changed, 3 insertions, 1 deletions
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::Context> 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;