diff mbox

[ovs-dev,05/40] datapath-windows: Fix possible NULL dereference in IpFragment

Message ID BY2PR0501MB211980DD124111FB51821E2DA2AD0@BY2PR0501MB2119.namprd05.prod.outlook.com
State Not Applicable
Headers show

Commit Message

Shashank Ram July 14, 2017, 4:49 p.m. UTC
This will result in a memory leak, comments inline.

Thanks,
Shashank
diff mbox

Patch

diff --git a/datapath-windows/ovsext/IpFragment.c b/datapath-windows/ovsext/IpFragment.c
index e601a15..eb278ef 100644
--- a/datapath-windows/ovsext/IpFragment.c
+++ b/datapath-windows/ovsext/IpFragment.c
@@ -205,7 +205,7 @@  OvsIpv4Reassemble(POVS_SWITCH_CONTEXT switchContext,
     *newNbl = OvsAllocateNBLFromBuffer(switchContext, packetBuf, packetLen);
     if (*newNbl == NULL) {
         OVS_LOG_ERROR("Insufficient resources, failed to allocate newNbl");
-        status = NDIS_STATUS_RESOURCES;
+        return NDIS_STATUS_RESOURCES;

----
This will result in a memory leak because packetBuf is allocated above and not freed yet.
    packetBuf = (CHAR*)OvsAllocateMemoryWithTag(packetLen,