Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: third_party/lcms2-2.6/0005-memory-leak-AllocEmptyTransform.patch

Issue 2359243003: Fix memory leaks in lcms (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 diff --git a/third_party/lcms2-2.6/src/cmsxform.c b/third_party/lcms2-2.6/src/cm sxform.c
2 index eddb9bd..6466d27 100644
3 --- a/third_party/lcms2-2.6/src/cmsxform.c
4 +++ b/third_party/lcms2-2.6/src/cmsxform.c
5 @@ -593,7 +593,10 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cm sPipeline* lut,
6
7 // Allocate needed memory
8 _cmsTRANSFORM* p = (_cmsTRANSFORM*) _cmsMallocZero(ContextID, sizeof(_cmsTR ANSFORM));
9 - if (!p) return NULL;
10 + if (!p) {
11 + cmsPipelineFree(lut);
12 + return NULL;
13 + }
14
15 // Store the proposed pipeline
16 p ->Lut = lut;
17 @@ -643,7 +646,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cms Pipeline* lut,
18 if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) {
19
20 cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
21 - _cmsFree(ContextID, p);
22 + cmsDeleteTransform(p);
23 return NULL;
24 }
25
26 @@ -673,7 +676,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cms Pipeline* lut,
27 if (p ->FromInput == NULL || p ->ToOutput == NULL) {
28
29 cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsuppor ted raster format");
30 - _cmsFree(ContextID, p);
31 + cmsDeleteTransform(p);
32 return NULL;
33 }
34
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698