summaryrefslogtreecommitdiff
path: root/xmerge/source
diff options
context:
space:
mode:
authorjan iversen <jani@documentfoundation.org>2015-11-04 18:06:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-04 20:27:21 +0100
commit5a29db7a9945c4cd095799451a6c563d5aeeed57 (patch)
tree3cc98c80ce8a40d5456091ee3225cfa724334821 /xmerge/source
parent327ed70fa568c0ea3944a5c714479dca03d5f3d5 (diff)
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
Diffstat (limited to 'xmerge/source')
-rw-r--r--xmerge/source/bridge/java/XMergeBridge.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java
index 06d3b4b10564..5793f4fd78a6 100644
--- a/xmerge/source/bridge/java/XMergeBridge.java
+++ b/xmerge/source/bridge/java/XMergeBridge.java
@@ -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){