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

Side by Side Diff: third_party/lcms2-2.6/0004-memory-leak-Type_Curve_Read.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
« no previous file with comments | « no previous file | third_party/lcms2-2.6/0005-memory-leak-AllocEmptyTransform.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/third_party/lcms2-2.6/src/cmstypes.c b/third_party/lcms2-2.6/src/cm stypes.c
2 index 06742b5..9fe5e2a 100644
3 --- a/third_party/lcms2-2.6/src/cmstypes.c
4 +++ b/third_party/lcms2-2.6/src/cmstypes.c
5 @@ -1112,7 +1112,10 @@ void *Type_Curve_Read(struct _cms_typehandler_struct* sel f, cmsIOHANDLER* io, cm
6 NewGamma = cmsBuildTabulatedToneCurve16(self ->ContextID, Count, NULL);
7 if (!NewGamma) return NULL;
8
9 - if (!_cmsReadUInt16Array(io, Count, NewGamma -> Table16)) return NULL;
10 + if (!_cmsReadUInt16Array(io, Count, NewGamma -> Table16)) {
11 + cmsFreeToneCurve(NewGamma);
12 + return NULL;
13 + }
14
15 *nItems = 1;
16 return NewGamma;
17 @@ -2350,7 +2353,10 @@ cmsStage* ReadCLUT(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUI
18
19 for (i=0; i < Data ->nEntries; i++) {
20
21 - if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) return NULL;
22 + if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) {
23 + cmsStageFree(CLUT);
24 + return NULL;
25 + }
26 Data ->Tab.T[i] = FROM_8_TO_16(v);
27 }
28
OLDNEW
« no previous file with comments | « no previous file | third_party/lcms2-2.6/0005-memory-leak-AllocEmptyTransform.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698