[PATCH xserver] xfree86: fix minor memory leak
Hans de Goede
hdegoede at redhat.com
Mon Nov 23 00:36:55 PST 2015
Hi,
On 22-11-15 23:00, Peter Hutterer wrote:
> xf86*StrOption returns a strdup
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Looks good to me, thanks for fixing the leak I think I introduced :)
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> hw/xfree86/common/xf86Xinput.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index a5b0568..c56a2b9 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -843,7 +843,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
> DeviceIntPtr dev = NULL;
> Bool paused;
> int rval;
> - const char *path;
> + char *path = NULL;
>
> /* Memory leak for every attached device if we don't
> * test if the module is already loaded first */
> @@ -873,6 +873,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
> new_input_devices[new_input_devices_count] = pInfo;
> new_input_devices_count++;
> systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
> + free(path);
> return BadMatch;
> }
> pInfo->fd = fd;
> @@ -881,6 +882,8 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
> }
> }
>
> + free(path);
> +
> xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName,
> pInfo->name);
>
>
More information about the xorg-devel
mailing list