[PATCH weston] hmi-controller: fix leak of ivi surface list

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 4 11:47:43 UTC 2016


On Thu,  3 Mar 2016 19:56:52 +0900
Wataru Natsume <wataru_natsume at xddp.denso.co.jp> wrote:

> From: Wataru Natsume <WATARU_NATSUME at xddp.denso.co.jp>
> 
> get_surfaces_on_layer() allocates memory and stores the pointer to 'ivisurfs'. But it was not freed.
> 
> Signed-off-by: Wataru Natsume <WATARU_NATSUME at xddp.denso.co.jp>
> ---
>  ivi-shell/hmi-controller.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
> index ace6555..6548ed7 100644
> --- a/ivi-shell/hmi-controller.c
> +++ b/ivi-shell/hmi-controller.c
> @@ -655,7 +655,7 @@ set_notification_configure_surface(struct ivi_layout_surface *ivisurf,
>  	struct hmi_controller_layer *layer_link = NULL;
>  	struct ivi_layout_layer *application_layer = NULL;
>  	struct weston_surface *surface;
> -	struct ivi_layout_surface **ivisurfs;
> +	struct ivi_layout_surface **ivisurfs = NULL;
>  	int32_t length = 0;
>  	int32_t i;
>  
> @@ -690,9 +690,12 @@ set_notification_configure_surface(struct ivi_layout_surface *ivisurf,
>  				 * commit_changes to apply source_rectangle.
>  				 */
>  				ivi_layout_interface->commit_changes();
> +				free(ivisurfs);
>  				return;
>  			}
>  		}
> +		free(ivisurfs);
> +		ivisurfs = NULL;
>  	}
>  
>  	switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);

Hi Natsume-san,

I line-wrapped the commit message. The set to NULL after free isn't
necessary so we don't tend to do that, but I let it be there. R-b me and
pushed:
   7e7f793..9d8b441  master -> master


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160304/87c0afd1/attachment.sig>


More information about the wayland-devel mailing list