Kaydet (Commit) 0b9ceae7 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1326474 Resource leak on an exceptional path

Change-Id: I13047e59fc10ab169072f84c75ba88c569d16bd6
üst 1e83fab9
......@@ -364,6 +364,11 @@ public class XMergeBridge {
}
private static void close(FileOutputStream c) throws IOException {
if (c == null) return;
c.close();
}
private void convert (com.sun.star.io.XInputStream xml,com.sun.star.io.XOutputStream device,
boolean convertFromOffice,String pluginUrl,String FileName,String offMime,String sdMime) throws com.sun.star.uno.RuntimeException, IOException {
......@@ -436,11 +441,15 @@ public class XMergeBridge {
newFile =new File(newFileName.concat(String.valueOf(i)));
}
FileOutputStream fos = new FileOutputStream(newFile);
docOut = (Document)docEnum.next();
docOut.write(fos);
fos.flush();
fos.close();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(newFile);
docOut = (Document)docEnum.next();
docOut.write(fos);
fos.flush();
} finally {
close(fos);
}
i++;
}
......
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