#vulnerable code 
                                public static void save(File target, Properties p) throws IOException {
        File parent = target.getParentFile();
        parent.mkdirs();
        if (isWindows()) {
            p.store(new FileWriter(target), "saved for test");
        } else {
            File tempFile = File.createTempFile(target.getName(), "temp", parent);
            p.store(new FileWriter(tempFile), "saved for test");
            if (!tempFile.renameTo(target))
                throw new IOException(String.format("Failed to overwrite %s to %s", tempFile.toString(),
                        target.toString()));
        }
    } 
                            #location 5 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static void save(File target, Properties p) throws IOException {
        File parent = target.getParentFile();
        parent.mkdirs();
        if (isWindows()) {
            store(new FileOutputStream(target), p);
        } else {
            File tempFile = createTempFile(target.getName(), ".temp", parent);
            store(new FileOutputStream(tempFile), p);
            rename(tempFile, target);
        }
    }