#vulnerable code 
                                public static ArrayList<String> runNative(String[] cmdToRunWithArgs) {
        Process p = null;
        try {
            p = Runtime.getRuntime().exec(cmdToRunWithArgs);
        } catch (IOException e) {
            LOG.trace("", e);
            return null;
        }

        BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = "";
        ArrayList<String> sa = new ArrayList<>();
        try {
            while ((line = reader.readLine()) != null) {
                sa.add(line);
            }
            p.waitFor();
        } catch (InterruptedException e) {
            LOG.trace("", e);
            return null;
        } catch (IOException e) {
            LOG.trace("", e);
            return null;
        }
        return sa;
    } 
                            #location 18 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static ArrayList<String> runNative(String[] cmdToRunWithArgs) {
        Process p = null;
        try {
            p = Runtime.getRuntime().exec(cmdToRunWithArgs);
        } catch (IOException e) {
            LOG.trace("", e);
            return null;
        }

        ArrayList<String> sa = new ArrayList<>();
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
            String line;
            while ((line = reader.readLine()) != null) {
                sa.add(line);
            }
            p.waitFor();
        } catch (InterruptedException e) {
            LOG.trace("", e);
            return null;
        } catch (IOException e) {
            LOG.trace("", e);
            return null;
        }
        return sa;
    }