Re: [PATCH BlueZ] mesh: Fix memory leak when failing to load a node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied

On Mon, 2020-11-09 at 20:24 -0800, Inga Stotland wrote:
> This fixes a memory leak that may occur on unsuccessful element
> initialization from storage.
> ---
>  mesh/node.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index 11b0c9442..35293e0f0 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -326,16 +326,13 @@ static bool add_element_from_storage(struct mesh_node *node,
>  
>  	ele->idx = db_ele->index;
>  	ele->location = db_ele->location;
> -
> -
> -	if (!ele->models)
> -		ele->models = l_queue_new();
> +	ele->models = l_queue_new();
> +	l_queue_push_tail(node->elements, ele);
>  
>  	if (!mesh_model_add_from_storage(node, ele->idx, ele->models,
>  							db_ele->models))
>  		return false;
>  
> -	l_queue_push_tail(node->elements, ele);
>  	return true;
>  }
>  




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux