fix unused variable warning.
free pointer before returning.
Modified: trunk/reactos/apps/utils/net/route/route.c
_____
Modified: trunk/reactos/apps/utils/net/route/route.c
--- trunk/reactos/apps/utils/net/route/route.c 2005-10-01 18:14:17 UTC
(rev 18195)
+++ trunk/reactos/apps/utils/net/route/route.c 2005-10-01 18:41:02 UTC
(rev 18196)
@@ -20,7 +20,7 @@
#define IPBUF 17
#define IN_ADDR_OF(x) *((struct in_addr *)&(x))
-int usage()
+int Usage()
{
fprintf( stderr,
"route usage:\n"
@@ -33,11 +33,11 @@
return 1;
}
-int print_routes()
+int PrintRoutes()
{
PMIB_IPFORWARDTABLE IpForwardTable = NULL;
PIP_ADAPTER_INFO pAdapterInfo = NULL;
- DWORD Error;
+ DWORD Error = 0;
ULONG Size = 0;
ULONG adaptOutBufLen;
TCHAR DefGate[16];
@@ -52,8 +52,8 @@
if( (GetIpForwardTable( NULL, &Size, TRUE )) ==
ERROR_INSUFFICIENT_BUFFER )
IpForwardTable = malloc( Size );
- if ((GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) == NO_ERROR) &&
- GetIpForwardTable( IpForwardTable, &Size, TRUE ) == NO_ERROR)
+ if ((Error = (GetAdaptersInfo(pAdapterInfo, &adaptOutBufLen) ==
NO_ERROR)) &&
+ (Error = (GetIpForwardTable(IpForwardTable, &Size, TRUE) ==
NO_ERROR)))
{
_tcsncpy(DefGate, pAdapterInfo->GatewayList.IpAddress.String,
16);
_tprintf(_T("===========================================================
================\n"));
@@ -90,7 +90,8 @@
_tprintf(_T("===========================================================
================\n"));
_tprintf(_T("Persistent Routes:\n"));
- free( IpForwardTable );
+ free(IpForwardTable);
+ free(pAdapterInfo);
return ERROR_SUCCESS;
}
@@ -181,13 +182,13 @@
{
if( argc < 2 )
- return usage();
+ return Usage();
else if ( !strcasecmp( argv[1], "print" ) )
- return print_routes();
+ return PrintRoutes();
else if( !strcasecmp( argv[1], "add" ) )
return add_route( argc-2, argv+2 );
else if( !strcasecmp( argv[1], "delete" ) )
return del_route( argc-2, argv+2 );
else
- return usage();
+ return Usage();
}
Show replies by date