RFR JDK-8007609

Alan Bateman Alan.Bateman at oracle.com
Wed Feb 6 10:18:28 UTC 2013


On 05/02/2013 23:49, John Zavgren wrote:
> Greetings:
>
> I modified the code in
> src/windows/native/java/io/WinNTFileSystem_md.c
> so that it checks the return value of realloc() and frees memory when there is an error.
>
> The webrev image of this change is visible at:
> http://cr.openjdk.java.net/~jzavgren/8007609/webrev.01/
>
> Thanks!
> John Zavgren
Formatting aside, it looks like the change means that a realloc fail 
will leave the file open. I think this is all that is needed:

WCHAR* newResult = (WCHAR*)realloc(...);
if (newResult != NULL) {
     len = (*GetFinalPathNameByHandle_func)( h, newResult, len, 0);
} else {
     free(result);
     len = 0;
}
result = newResult;

-Alan.



More information about the core-libs-dev mailing list