Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8260432: allocateSpaceForGP in freetypeScaler.c might leak memory
Reviewed-by: shade, stuefe
  • Loading branch information
MBaesken committed Jan 28, 2021
1 parent abc4300 commit 3aabbd7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/java.desktop/share/native/libfontmanager/freetypeScaler.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1285,10 +1285,18 @@ static int allocateSpaceForGP(GPData* gpdata, int npoints, int ncontours) {
}

/* failure if any of mallocs failed */
if (gpdata->pointTypes == NULL || gpdata->pointCoords == NULL)
if (gpdata->pointTypes == NULL || gpdata->pointCoords == NULL) {
if (gpdata->pointTypes != NULL) {
free(gpdata->pointTypes);
gpdata->pointTypes = NULL;
}
if (gpdata->pointCoords != NULL) {
free(gpdata->pointCoords);
gpdata->pointCoords = NULL;
}
return 0;
else
return 1;
}
return 1;
}

static void addSeg(GPData *gp, jbyte type) {
Expand Down

1 comment on commit 3aabbd7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.