[PATCH weston v2 2/9] wayland-backend: fix memory leak of display_name

Pekka Paalanen ppaalanen at gmail.com
Wed May 4 12:49:15 UTC 2016


On Thu, 28 Apr 2016 20:33:09 +0200
Benoit Gschwind <gschwind at gnu-log.net> wrote:

> Signed-off-by: Benoit Gschwind <gschwind at gnu-log.net>
> ---
>  src/compositor-wayland.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index 8577a74..0bfd3ad 100644
> --- a/src/compositor-wayland.c
> +++ b/src/compositor-wayland.c
> @@ -2440,9 +2440,11 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
>  				          MODIFIER_CTRL | MODIFIER_ALT,
>  				          fullscreen_binding, b);
>  
> +	free(new_config.display_name);
>  	return 0;
>  
>  err_outputs:
>  	wayland_backend_destroy(b);
> +	free(new_config.display_name);
>  	return -1;
>  }

Hi,

the free() should actually be just after the call to
wayland_backend_create(), because there are many many return statements
before the points where you added it.

However, assuming the later patches also fix this, and changing this
here would cause merge conflicts, I'll leave it as is. It is an
improvement anyway.


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/20160504/49fd1365/attachment-0001.sig>


More information about the wayland-devel mailing list