[haiku-commits] Re: r38054 - haiku/trunk/src/add-ons/kernel/network/stack

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 12 Aug 2010 22:02:54 +0200

Hi,

On 2010-08-12 at 15:27:50 [+0200], axeld@xxxxxxxxxxxxxxxx wrote:
> Author: axeld
> Date: 2010-08-12 15:27:50 +0200 (Thu, 12 Aug 2010)
> New Revision: 38054
> Changeset: http://dev.haiku-os.org/changeset/38054
> 
> Modified:
>    haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp
> Log:
> * Also create a new address for B_SOCKET_SET_ALIAS if the index is -1 - this
>   now has an almost equivalent logic to the old setters like SIOCSIFADDR.
> 
> 
> Modified: haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp
> ===================================================================
> --- haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp    
> 2010-08-12 13:25:45 UTC (rev 38053)
> +++ haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp    
> 2010-08-12 13:27:50 UTC (rev 38054)
> @@ -724,6 +724,19 @@
>                      // Find first address for family
>                      address = FirstForFamily(domain->family);
>                  }
> +                if (address == NULL) {
> +                    // Create new on the fly
> +                    address = new(std::nothrow) InterfaceAddress(this, 
> domain);
> +                    if (address == NULL)
> +                        return B_NO_MEMORY;
> +
> +                    status_t status = AddAddress(address);
> +                    if (status != B_OK)
> +                        return status;

Haven't looked what AddAddress() does, but it looks like a leak in the error 
case?

Best regards,
-Stephan

Other related posts: