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. <br>----- Original Message -----<br>From: alan.bate...@oracle.com<br>To: john.zavg...@oracle.com<br>Cc: core-libs-dev@openjdk.java.net<br>Sent: Wednesday, February 6, 2013 5:18:28 AM GMT -05:00 US/Canada Eastern<br>Subject: Re: RFR JDK-8007609<br><br><html> <head> </head> <div> On 05/02/2013 23:49, John Zavgren wrote: <blockquote cite="mid:3d9879ec-77e4-42f7-bc90-578d7c488054@default"> <pre>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: <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~jzavgren/8007609/webrev.01/" target="_blank">http://cr.openjdk.java.net/~jzavgren/8007609/webrev.01/</a> Thanks! John Zavgren </pre> </blockquote> 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:<br> <br> WCHAR* newResult = (WCHAR*)realloc(...);<br> if (newResult != NULL) {<br> len = <span class="changed">(*GetFinalPathNameByHandle_func)(</span> <span class="changed">h, newResult, len, 0);</span><br> } else {<br> free(result);<br> len = 0;<br> }<br> result = newResult;<br> <br> -Alan.<br> </div> </html>