RFR JDK-8007609

John Zavgren john.zavgren at oracle.com
Wed Feb 6 14:59:54 UTC 2013


Alan: 
I apologize... I read the code again and I don't see any issues with your change. 


John 
----- Original Message ----- 
From: john.zavgren at oracle.com 
To: Alan.Bateman at oracle.com 
Cc: core-libs-dev at openjdk.java.net 
Sent: Wednesday, February 6, 2013 9:57:03 AM GMT -05:00 US/Canada Eastern 
Subject: Re: RFR JDK-8007609 

Alan: I like your change, but I think the free(result) statement would need to be eliminated, otherwise the block a few lines later: /* Unable to get final path. */ if(len == 0 && result != NULL) { free(result); result = NULL; } would cause result to be freed twice. 
----- Original Message ----- 
From: Alan.Bateman at oracle.com 
To: john.zavgren at oracle.com 
Cc: core-libs-dev at openjdk.java.net 
Sent: Wednesday, February 6, 2013 5:18:28 AM GMT -05:00 US/Canada Eastern 
Subject: Re: RFR JDK-8007609 


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