# HG changeset patch # User goetz # Date 1469020068 -7200 # Node ID 092b8f96548c93fa043ff9d2243abfb80af25420 # Parent ce8600f2919ef473f792edc29edeaf69a95d000c 8161923: Fix two memory issues. Reviewed-by: vadim diff --git a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp --- a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp +++ b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp @@ -150,11 +150,12 @@ TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset.getAlias()); glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); - if(mm==nComponents) { + ++mm; + if (mm == nComponents) { LE_DEBUG_BAD_FONT("exceeded nComponents"); mm--; // don't overrun the stack. } - stack[++mm] = componentGlyph; + stack[mm] = componentGlyph; i = 0; } else { glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); diff --git a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp --- a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp +++ b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp @@ -143,17 +143,18 @@ } if (action & (lafLast | lafStore)) { - TTGlyphID ligatureGlyph = SWAPW(ligatureTable(i,success)); - if (LE_FAILURE(success)) { - currGlyph+= dir; - return nextStateIndex; - } + TTGlyphID ligatureGlyph = SWAPW(ligatureTable(i,success)); + if (LE_FAILURE(success)) { + currGlyph+= dir; + return nextStateIndex; + } glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph); - if(mm==nComponents) { + ++mm; + if (mm == nComponents) { LE_DEBUG_BAD_FONT("exceeded nComponents"); mm--; // don't overrun the stack. } - stack[++mm] = componentGlyph; + stack[mm] = componentGlyph; i = 0; } else { glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF); diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp --- a/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp @@ -1132,7 +1132,7 @@ if (dwRet != IDOK) { /* if failure, cleanup and return failure */ - GlobalFree(pDevMode); + GlobalFree(*pDevMode); *pDevMode = NULL; return FALSE; }