]> git.proxmox.com Git - ovs.git/commitdiff
datapath-windows: Handle memory allocation failure for event creation
authorSairam Venugopal <vsairam@vmware.com>
Tue, 21 Jun 2016 23:54:02 +0000 (16:54 -0700)
committerGurucharan Shetty <guru@ovn.org>
Fri, 24 Jun 2016 21:28:28 +0000 (14:28 -0700)
Release the lock and return if an event entry fails to get allocated.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
datapath-windows/ovsext/Event.c

index abf8f0d42bcf9bf065d8c2dd1ec4cbef7c5cb156..f9bea7f51fbc14c356ebe6ad787d7d1fa09ff143 100644 (file)
@@ -134,6 +134,13 @@ OvsPostEvent(POVS_EVENT_ENTRY event)
 
         elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemoryWithTag(
             sizeof(*elem), OVS_EVENT_POOL_TAG);
+
+        if (elem == NULL) {
+            OVS_LOG_WARN("Fail to allocate memory for event");
+            OvsReleaseEventQueueLock();
+            return;
+        }
+
         RtlCopyMemory(&elem->event, event, sizeof elem->event);
         InsertTailList(&queue->elemList, &elem->link);
         queue->numElems++;