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


John 
----- Original Message ----- 
From: john.zavg...@oracle.com 
To: alan.bate...@oracle.com 
Cc: core-libs-dev@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.bate...@oracle.com 
To: john.zavg...@oracle.com 
Cc: core-libs-dev@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. 

Reply via email to