Bug 91457

Summary: [PATCH] rdp-backend: double free error when using unhandled option
Product: Wayland Reporter: Dawid Gajownik <gajownik>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: rdp.effort
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: weston output
free rdp_backend, not compositor

Description Dawid Gajownik 2015-07-25 03:36:01 UTC
Created attachment 117363 [details]
weston output

Weston with rdp-backend crashes with double free error message when unknown messages is used.

Reproduction steps:
weston --backend=rdp-backend.so --rdp4-key=test  --makemecrash

[snip]

[23:58:23.132] fatal: unhandled option: --makemecrash
*** Error in `weston': double free or corruption (!prev): 0x0000000000f0a8c0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x77a8d)[0x7f44f4e60a8d]
/lib64/libc.so.6(cfree+0x5cd)[0x7f44f4e6cd2d]
weston[0x40858a]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7f44f4e09700]
weston(_start+0x29)[0x4089f9]

Explanation:
src/main.c:826
        weston_compositor_destroy(ec)

src/compositor.c:weston_compositor_destroy()

        compositor->backend->destroy(compositor);
        free(compositor);

src/compositor-rdp.c:rdp_destroy(struct weston_compositor *ec)
{
        weston_compositor_shutdown(ec);

        free(ec);
}

        
weston_compositor_destroy() is the same function rdp_destroy(). ec and compositor are the same pointers. free(compositor) is the second free() that crashes weston.
Comment 1 Dawid Gajownik 2015-07-25 03:37:26 UTC
Created attachment 117364 [details] [review]
free rdp_backend, not compositor

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.