[ros-diffs] [cgutman] 38729: - Don't crash if IPRemoveInterfaceRoute is called twice - Found by memtrack :)

cgutman at svn.reactos.org cgutman at svn.reactos.org
Mon Jan 12 19:04:14 CET 2009


Author: cgutman
Date: Mon Jan 12 12:04:14 2009
New Revision: 38729

URL: http://svn.reactos.org/svn/reactos?rev=38729&view=rev
Log:
 - Don't crash if IPRemoveInterfaceRoute is called twice
 - Found by memtrack :)

Modified:
    branches/aicom-network-fixes/lib/drivers/ip/network/ip.c

Modified: branches/aicom-network-fixes/lib/drivers/ip/network/ip.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers/ip/network/ip.c?rev=38729&r1=38728&r2=38729&view=diff
==============================================================================
--- branches/aicom-network-fixes/lib/drivers/ip/network/ip.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/lib/drivers/ip/network/ip.c [iso-8859-1] Mon Jan 12 12:04:14 2009
@@ -309,22 +309,20 @@
     PNEIGHBOR_CACHE_ENTRY NCE;
     IP_ADDRESS GeneralRoute;
 
-    TCPDisposeInterfaceData( IF->TCPContext );
-    IF->TCPContext = NULL;
-
-    TI_DbgPrint(DEBUG_IP,("Removing interface Addr %s\n", A2S(&IF->Unicast)));
-    TI_DbgPrint(DEBUG_IP,("                   Mask %s\n", A2S(&IF->Netmask)));
-
-    AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
-
-    RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
-
-    /* Remove permanent NCE, but first we have to find it */
     NCE = NBLocateNeighbor(&IF->Unicast);
     if (NCE)
-	NBRemoveNeighbor(NCE);
-    else
-	TI_DbgPrint(DEBUG_IP, ("Could not delete IF route (0x%X)\n", IF));
+    {
+       TCPDisposeInterfaceData( IF->TCPContext );
+
+       TI_DbgPrint(DEBUG_IP,("Removing interface Addr %s\n", A2S(&IF->Unicast)));
+       TI_DbgPrint(DEBUG_IP,("                   Mask %s\n", A2S(&IF->Netmask)));
+
+       AddrWidenAddress(&GeneralRoute,&IF->Unicast,&IF->Netmask);
+
+       RouterRemoveRoute(&GeneralRoute, &IF->Unicast);
+
+       NBRemoveNeighbor(NCE);
+    }
 }
 
 VOID IPUnregisterInterface(



More information about the Ros-diffs mailing list