# HG changeset patch # User dxu # Date 1381510046 25200 # Node ID 6c440a257019a80a9ecd078aa7e123c3c35f548a # Parent a7cd22051d8f53fcdeeed55288d63530425a9111 8025712: (props) Possible memory leak in java_props_md.c / ParseLocale Reviewed-by: naoto, chegar diff -r a7cd22051d8f -r 6c440a257019 jdk/src/solaris/native/java/lang/java_props_md.c --- a/jdk/src/solaris/native/java/lang/java_props_md.c Fri Oct 11 09:17:18 2013 -0400 +++ b/jdk/src/solaris/native/java/lang/java_props_md.c Fri Oct 11 09:47:26 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, 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 @@ -158,6 +158,9 @@ temp = malloc(strlen(lc) + 1); if (temp == NULL) { +#ifdef MACOSX + free(lc); // malloced memory +#endif JNU_ThrowOutOfMemoryError(env, NULL); return 0; } @@ -172,7 +175,6 @@ * the encoding - without it, we wouldn't get ISO-8859-15. * Therefore, this code section is Solaris-specific. */ - lc = strdup(lc); /* keep a copy, setlocale trashes original. */ strcpy(temp, lc); p = strstr(temp, "@euro"); if (p != NULL) {