#vulnerable code 
                                public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
        throws Exception {
        ExtentTestManager.loadConfig();
        if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
            child = ExtentTestManager.startTest(methodName)
                .assignCategory(category + "_" + device_udid.replaceAll("\\W", "_"));
        }
        Thread.sleep(3000);
        if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
            driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidWeb());
        } else {
            if (System.getProperty("os.name").toLowerCase().contains("mac")) {
                if (iosDevice.checkiOSDevice(device_udid)) {
                    driver = new IOSDriver<>(appiumMan.getAppiumUrl(), iosNative());
                } else if (!iosDevice.checkiOSDevice(device_udid)) {
                    driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidNative());
                }
            } else {
                driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), androidNative());
            }
        }

        return driver;
    } 
                            #location 16 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName)
        throws Exception {
        ExtentTestManager.loadConfig();
        if (prop.getProperty("FRAMEWORK").equalsIgnoreCase("testng")) {
            child = ExtentTestManager.startTest(methodName.toString())
                .assignCategory(category + "_" + device_udid.replaceAll("\\W", "_"));
        }
        Thread.sleep(3000);
        startingServerInstance();
        return driver;
    }