diff options
author | kcwu <kcwu@chromium.org> | 2016-09-22 18:26:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-22 18:26:22 -0700 |
commit | 39ee9dfac1c6d286a4075c7e2435fe1cfe365bad (patch) | |
tree | bd2ff8c788b1411ee34d84e1c47d50f251a5cf01 /third_party/lcms2-2.6/src/cmsxform.c | |
parent | fe0179ded8202939ea4f2b92a879b8dede7821ea (diff) | |
download | pdfium-39ee9dfac1c6d286a4075c7e2435fe1cfe365bad.tar.xz |
Fix memory leaks in lcms
found by libfuzzer
Review-Url: https://codereview.chromium.org/2359243003
Diffstat (limited to 'third_party/lcms2-2.6/src/cmsxform.c')
-rw-r--r-- | third_party/lcms2-2.6/src/cmsxform.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/third_party/lcms2-2.6/src/cmsxform.c b/third_party/lcms2-2.6/src/cmsxform.c index eddb9bd02c..6466d27c3e 100644 --- a/third_party/lcms2-2.6/src/cmsxform.c +++ b/third_party/lcms2-2.6/src/cmsxform.c @@ -593,7 +593,10 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, // Allocate needed memory _cmsTRANSFORM* p = (_cmsTRANSFORM*) _cmsMallocZero(ContextID, sizeof(_cmsTRANSFORM)); - if (!p) return NULL; + if (!p) { + cmsPipelineFree(lut); + return NULL; + } // Store the proposed pipeline p ->Lut = lut; @@ -643,7 +646,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) { cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); - _cmsFree(ContextID, p); + cmsDeleteTransform(p); return NULL; } @@ -673,7 +676,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, if (p ->FromInput == NULL || p ->ToOutput == NULL) { cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); - _cmsFree(ContextID, p); + cmsDeleteTransform(p); return NULL; } |