Hey Ritu, Thanks! Could you post the patch as a separate review? That way it will be a lot easier for me to merge the changes.
The easiest way to do it is to base the new patch on the current state of the master branch. Cheers, Hugo On 29 jul. 2014, at 22:32, Ritu Sabharwal <rsabh...@brocade.com> wrote: > Hi Hugo, > > I have fixed the reported findings and posted the patch on review board. > > Thanks & Regards, > Ritu S. > > From: Trippie [mailto:trip...@gmail.com] On Behalf Of Hugo Trippaers > Sent: Tuesday, July 29, 2014 6:41 AM > To: Ritu Sabharwal > Cc: <dev@cloudstack.apache.org>; Santhosh Edukulla > Subject: Fwd: New Defects reported by Coverity Scan for cloudstack > > Ritu, > > Coverity identified a number of issues with the brocade plugin. Could you > have a look at them and post the fixes on the review board? > > > If you need additional details on the findings you can request coverity > access here : https://scan.coverity.com/projects/943 > > Cheers, > > Hugo > > > Begin forwarded message: > > > From: scan-ad...@coverity.com > Subject: New Defects reported by Coverity Scan for cloudstack > Date: 29 juli 2014 15:22:48 CEST > > > Hi, > > > Please find the latest report on new defect(s) introduced to cloudstack found > with Coverity Scan. > > Defect(s) Reported-by: Coverity Scan > Showing 7 of 7 defect(s) > > > ** CID 1229114: Resource leak (RESOURCE_LEAK) > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 509 in > com.cloud.network.brocade.BrocadeVcsApi.responseToErrorMessage(org.apache.http.HttpResponse)() > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 513 in > com.cloud.network.brocade.BrocadeVcsApi.responseToErrorMessage(org.apache.http.HttpResponse)() > > ** CID 1229113: Resource leak (RESOURCE_LEAK) > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 457 in > com.cloud.network.brocade.BrocadeVcsApi.executeRetreiveStatus(java.lang.String)() > > ** CID 1229115: Dereference before null check (REVERSE_INULL) > /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java: > 6299 in > com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cloud.agent.api.CreateVMSnapshotCommand)() > > ** CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 67 in () > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 71 in () > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 55 in () > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 59 in () > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 63 in () > > ** CID 1229120: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR) > /engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java: 478 in > com.cloud.capacity.dao.CapacityDaoImpl.findCapacityBy(java.lang.Integer, > java.lang.Long, java.lang.Long, java.lang.Long)() > > ** CID 1229119: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE) > /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java: > 4438 in > com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.initialize()() > > ** CID 1229116: REC: RuntimeException capture (FB.REC_CATCH_EXCEPTION) > /engine/schema/src/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java: 189 in > com.cloud.storage.dao.VMTemplatePoolDaoImpl.listByTemplateStatus(long, long, > long, com.cloud.storage.VMTemplateStorageResourceAssoc$Status)() > > > ________________________________________________________________________________________________________ > *** CID 1229114: Resource leak (RESOURCE_LEAK) > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 509 in > com.cloud.network.brocade.BrocadeVcsApi.responseToErrorMessage(org.apache.http.HttpResponse)() > 503 try { > 504 > 505 BufferedReader rd = new BufferedReader(new > InputStreamReader(response.getEntity().getContent(), > Charset.forName("UTF-8"))); > 506 > 507 StringBuffer result = new StringBuffer(); > 508 String line = ""; > > CID 1229114: Resource leak (RESOURCE_LEAK) > Variable "rd" going out of scope leaks the resource it refers to. > 509 while ((line = rd.readLine()) != null) { > 510 result.append(line); > 511 } > 512 > 513 return result.toString(); > 514 } catch (IOException e) { > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 513 in > com.cloud.network.brocade.BrocadeVcsApi.responseToErrorMessage(org.apache.http.HttpResponse)() > 507 StringBuffer result = new StringBuffer(); > 508 String line = ""; > 509 while ((line = rd.readLine()) != null) { > 510 result.append(line); > 511 } > 512 > > CID 1229114: Resource leak (RESOURCE_LEAK) > Variable "rd" going out of scope leaks the resource it refers to. > 513 return result.toString(); > 514 } catch (IOException e) { > 515 s_logger.debug("Error while loading response body", > e); > 516 } > 517 } > 518 return null; > 519 } > 520 > > ________________________________________________________________________________________________________ > *** CID 1229113: Resource leak (RESOURCE_LEAK) > /plugins/network-elements/brocade-vcs/src/com/cloud/network/brocade/BrocadeVcsApi.java: > 457 in > com.cloud.network.brocade.BrocadeVcsApi.executeRetreiveStatus(java.lang.String)() > 451 s_logger.error("Failed to get object : " + > e.getMessage()); > 452 throw new BrocadeVcsApiException("Failed to get object : > " + e.getMessage()); > 453 } > 454 > 455 pm.releaseConnection(); > 456 > > CID 1229113: Resource leak (RESOURCE_LEAK) > Variable "br" going out of scope leaks the resource it refers to. > 457 return convertToXML(sb.toString()); > 458 } > 459 > 460 protected void executeDeleteObject(String uri) throws > BrocadeVcsApiException { > 461 if (_host == null || _host.isEmpty() || _adminuser == null || > _adminuser.isEmpty() || _adminpass == null || _adminpass.isEmpty()) { > 462 throw new BrocadeVcsApiException("Hostname/credentials > are null or empty"); > > ________________________________________________________________________________________________________ > *** CID 1229115: Dereference before null check (REVERSE_INULL) > /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java: > 6299 in > com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.execute(com.cloud.agent.api.CreateVMSnapshotCommand)() > 6293 } catch (Exception e) { > 6294 if (!snapshotMemory) { > 6295 vm = createWorkingVM(conn, vmName, > guestOSType, platformEmulator, listVolumeTo); > 6296 } > 6297 } > 6298 > > CID 1229115: Dereference before null check (REVERSE_INULL) > Null-checking "vm" suggests that it may be null, but it has already been > dereferenced on all paths leading to the check. > 6299 if (vm == null) { > 6300 return new CreateVMSnapshotAnswer(cmd, false, > "Creating VM Snapshot Failed due to can not find vm: " + vmName); > 6301 } > 6302 > 6303 // call Xenserver API > 6304 if (!snapshotMemory) { > > ________________________________________________________________________________________________________ > *** CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 67 in () > 61 > 62 public void setProviderName(final String providerName) { > 63 this.providerName = providerName; > 64 } > 65 > 66 public void setDeviceName(final String deviceName) { > > CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > Unread field: com.cloud.api.response.BrocadeVcsDeviceResponse.deviceName > 67 this.deviceName = deviceName; > 68 } > 69 > 70 public void setHostName(final String hostName) { > 71 this.hostName = hostName; > 72 } > 73 > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 71 in () > 65 > 66 public void setDeviceName(final String deviceName) { > 67 this.deviceName = deviceName; > 68 } > 69 > 70 public void setHostName(final String hostName) { > > CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > Unread field: com.cloud.api.response.BrocadeVcsDeviceResponse.hostName > 71 this.hostName = hostName; > 72 } > 73 > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 55 in () > 49 > 50 @SerializedName(ApiConstants.HOST_NAME) > 51 @Param(description = "the principal switch Ip address") > 52 private String hostName; > 53 > 54 public void setId(String vcsDeviceId) { > > CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > Unread field: com.cloud.api.response.BrocadeVcsDeviceResponse.id > 55 this.id = vcsDeviceId; > 56 } > 57 > 58 public void setPhysicalNetworkId(final String physicalNetworkId) { > 59 this.physicalNetworkId = physicalNetworkId; > 60 } > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 59 in () > 53 > 54 public void setId(String vcsDeviceId) { > 55 this.id = vcsDeviceId; > 56 } > 57 > 58 public void setPhysicalNetworkId(final String physicalNetworkId) { > > CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > Unread field: > com.cloud.api.response.BrocadeVcsDeviceResponse.physicalNetworkId > 59 this.physicalNetworkId = physicalNetworkId; > 60 } > 61 > 62 public void setProviderName(final String providerName) { > 63 this.providerName = providerName; > 64 } > /plugins/network-elements/brocade-vcs/src/com/cloud/api/response/BrocadeVcsDeviceResponse.java: > 63 in () > 57 > 58 public void setPhysicalNetworkId(final String physicalNetworkId) { > 59 this.physicalNetworkId = physicalNetworkId; > 60 } > 61 > 62 public void setProviderName(final String providerName) { > > CID 1229121: UrF: Unread field (FB.URF_UNREAD_FIELD) > Unread field: com.cloud.api.response.BrocadeVcsDeviceResponse.providerName > 63 this.providerName = providerName; > 64 } > 65 > 66 public void setDeviceName(final String deviceName) { > 67 this.deviceName = deviceName; > 68 } > > ________________________________________________________________________________________________________ > *** CID 1229120: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR) > /engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java: 478 in > com.cloud.capacity.dao.CapacityDaoImpl.findCapacityBy(java.lang.Integer, > java.lang.Long, java.lang.Long, java.lang.Long)() > 472 tempCapacity = capacityMap.get(key); > 473 tempCapacity.setPodId(podId); > 474 tempCapacity.setClusterId(clusterId); > 475 } > 476 List<SummedCapacity> summedCapacityList = new > ArrayList<SummedCapacity>(); > 477 for (String key : capacityMap.keySet()) { > > CID 1229120: WMI: Inefficient Map Iterator (FB.WMI_WRONG_MAP_ITERATOR) > com.cloud.capacity.dao.CapacityDaoImpl.findCapacityBy(Integer, Long, Long, > Long) makes inefficient use of keySet iterator instead of entrySet iterator > 478 summedCapacityList.add(capacityMap.get(key)); > 479 } > 480 return summedCapacityList; > 481 } catch (SQLException e) { > 482 throw new CloudRuntimeException("DB Exception on: " + > sql, e); > 483 } catch (Throwable e) { > > ________________________________________________________________________________________________________ > *** CID 1229119: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE) > /plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java: > 4438 in > com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.initialize()() > 4432 > 4433 Pool pool; > 4434 try { > 4435 pool = Pool.getByUuid(conn, _host.pool); > 4436 Pool.Record poolr = pool.getRecord(conn); > 4437 > > CID 1229119: DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE) > Dead store to hostr > 4438 Host.Record hostr = poolr.master.getRecord(conn); > 4439 } catch (Throwable e) { > 4440 s_logger.warn("Check for master failed, failing the FULL > Cluster sync command"); > 4441 } > 4442 > 4443 StartupStorageCommand sscmd = initializeLocalSR(conn); > > ________________________________________________________________________________________________________ > *** CID 1229116: REC: RuntimeException capture (FB.REC_CATCH_EXCEPTION) > /engine/schema/src/com/cloud/storage/dao/VMTemplatePoolDaoImpl.java: 189 in > com.cloud.storage.dao.VMTemplatePoolDaoImpl.listByTemplateStatus(long, long, > long, com.cloud.storage.VMTemplateStorageResourceAssoc$Status)() > 183 long id = rs.getLong(1); // ID column > 184 result.add(findById(id)); > 185 } > 186 }catch (Exception e) { > 187 s_logger.warn("Exception: ", e); > 188 } > > CID 1229116: REC: RuntimeException capture (FB.REC_CATCH_EXCEPTION) > Catching RuntimeExceptions, perhaps unintentionally, with a catch block > for Exception > 189 } catch (Exception e) { > 190 s_logger.warn("Exception: ", e); > 191 } > 192 return result; > 193 > 194 } > > > ________________________________________________________________________________________________________ > To view the defects in Coverity Scan visit, > http://scan.coverity.com/projects/943?tab=overview > > To unsubscribe from the email notification for new > defects,http://scan5.coverity.com/cgi-bin/unsubscribe.py >