Kaydet (Commit) 5a29db7a authored tarafından jan iversen's avatar jan iversen Kaydeden (comit) Stephan Bergmann

Solved CID 1326472, 1326473, 1326474

Coverity requires that allocated objects (use of new)
are directly release, by foo = null;
The gc will do this automatically at some point in time,
so this will simply release the resource a bit earlier,
which can save problems if the function is called in a tight
loop.

Updated to add close() before clearing the variable, this would
normally be done by gc, but now a bit earlier. The assignment to
null is not needed specifically, but Coverity calls it a leak if
not assigned.

Forgot .close();

Change-Id: Id273e7f36778c1691b260d28e741c6e32148c9d9
üst 327ed70f
......@@ -437,6 +437,7 @@ public class XMergeBridge {
docOut.write(fos);
fos.flush();
fos.close();
fos = null;
i++;
}
......@@ -446,6 +447,12 @@ public class XMergeBridge {
ConverterInfoMgr.removeByJar(jarName);
}
catch (Exception ex1) {
/* Satisfy coverity */
newxos.flush();
newxos.close();
newxos = null;
xis.close();
xis = null;
IOException ex2 = new IOException();
ex2.initCause(ex1);
throw ex2;
......@@ -480,13 +487,24 @@ public class XMergeBridge {
System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
}
catch (Exception ex1) {
/* Satisfy coverity */
newxos.flush();
newxos.close();
newxos = null;
xis.close();
xis = null;
IOException ex2 = new IOException();
ex2.initCause(ex1);
throw ex2;
}
}
/* Satisfy coverity */
newxos.flush();
newxos.close();
newxos = null;
xis.close();
xis = null;
}
private String getPath(URI uri){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment