#vulnerable code 
                                public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName) throws Exception {
        child = ExtentTestManager
                .startTest(methodName).assignCategory(category + device_udid.replaceAll("\\W", "_"));
        if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
            androidWeb();
        } else {
        	System.out.println(iosDevice.checkiOSDevice(device_udid));
        	if (iosDevice.checkiOSDevice(device_udid)) {
        		iosNative();
        	} else {
        		androidNative();
        	}
        }

        Thread.sleep(5000);
        if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
        	driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), capabilities);
        } else{
        	if (iosDevice.checkiOSDevice(device_udid)) {
        		driver = new IOSDriver<>(appiumMan.getAppiumUrl(), capabilities);
        	} else if (!iosDevice.checkiOSDevice(device_udid)){
        		driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), capabilities);
        	}
        }

        return driver;
    } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public synchronized AppiumDriver<MobileElement> startAppiumServerInParallel(String methodName) throws Exception {
        child = ExtentTestManager
                .startTest(methodName).assignCategory(category + device_udid.replaceAll("\\W", "_"));
        if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
            androidWeb();
        } else {
        	System.out.println(iosDevice.checkiOSDevice(device_udid));
        	if (iosDevice.checkiOSDevice(device_udid)) {
        		iosNative();
        	} else if(!iosDevice.checkiOSDevice(device_udid)){
        		androidNative();
        	}
        }

        Thread.sleep(5000);
        if (prop.getProperty("APP_TYPE").equalsIgnoreCase("web")) {
        	driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), capabilities);
        } else{
        	if (iosDevice.checkiOSDevice(device_udid)) {
        		driver = new IOSDriver<>(appiumMan.getAppiumUrl(), capabilities);
        	} else if (!iosDevice.checkiOSDevice(device_udid)){
        		driver = new AndroidDriver<>(appiumMan.getAppiumUrl(), capabilities);
        	}
        }

        return driver;
    }