[DHCPD]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 15 May 2016 17:45:10 +0000 (17:45 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 15 May 2016 17:45:10 +0000 (17:45 +0000)
Plug leaks

svn path=/trunk/; revision=71335

rosapps/applications/net/dhcpd/src/display/display.c
rosapps/applications/net/dhcpd/src/parsing/parser.c

index d2de8a5..f1a3312 100644 (file)
@@ -56,6 +56,7 @@ int display_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo )
       break;
     }
   fprintf( stdout, "Message Type: %s \n", mtype );
+  free( mtype );
   return 0;
 }
 
index 80adda1..1a881b0 100644 (file)
@@ -209,6 +209,7 @@ int process_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo )
     if( find_lease( &dhcpl, dhcpm->xid, dhcpm->chaddr ) < 0 )
       {
        fprintf( stdout, "No free leases! \n" );
+       free( name );
        return -1;
       }
     dhcpm->op = BOOTREPLY;
@@ -281,6 +282,7 @@ int process_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo )
        sprintf( name, "%u.%u.%u.%u", (dhcpm->ciaddr &0xFF), ((dhcpm->ciaddr>>8)&0xFF), ((dhcpm->ciaddr>>16)&0xFF), ((dhcpm->ciaddr>>24)&0xFF));
        display_dhcp_packet( dhcpm, dhcpo );
        write_packet( dhcpm, name );
+       free( name );
        return -1;
       }
     dhcpm->siaddr = dhcpl.siaddr;
@@ -339,6 +341,7 @@ int process_dhcp_packet( DHCPMESSAGE *dhcpm, DHCPOPTIONS *dhcpo )
   display_dhcp_packet( dhcpm, dhcpo );
   write_packet( dhcpm, name );
   fprintf( stdout, "process_dhcp_packet [end]!\n");
+  free( name );
   return 0;
 }