Add check in case of NdisAllocateRWLock fails to allocate the resources.
Check datapath->lock before trying to free it.
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/92
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
DeleteAllFlows(datapath);
OvsFreeMemoryWithTag(datapath->flowTable, OVS_FLOW_POOL_TAG);
datapath->flowTable = NULL;
+
+ if (datapath->lock == NULL) {
+ return NDIS_STATUS_SUCCESS;
+ }
+
NdisFreeRWLock(datapath->lock);
return NDIS_STATUS_SUCCESS;
}
datapath->lock = NdisAllocateRWLock(switchContext->NdisFilterHandle);
+ if (!datapath->lock) {
+ return NDIS_STATUS_RESOURCES;
+ }
+
return NDIS_STATUS_SUCCESS;
}