<div dir="ltr"><div>I like this minimal fix better than the previous one that fixed the bug twice.<br><br></div>I think it would be clearer to just state that "wl_resource_post_error will crash if display_resource is null".<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 9:33 AM, Derek Foreman <span dir="ltr"><<a href="mailto:derekf@osg.samsung.com" target="_blank">derekf@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 11/01/16 04:45 AM, Marek Chalupa wrote:<br>
> if display_resource = wl_resource_create() fails in bind_display(),<br>
> we call wl_client_post_no_memory() which is wrong, since this function<br>
> uses display_resource (which is NULL at this point).<br>
> said simply: don't send an error to resource that you've just failed to create)<br>
><br>
> <a href="https://bugs.freedesktop.org/show_bug.cgi?id=91356" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=91356</a><br>
><br>
> Reported-by: Ashim <<a href="mailto:ashim.shah@samsung.com">ashim.shah@samsung.com</a>><br>
> Signed-off-by: Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>><br>
<br>
</span>Reviewed-by: Derek Foreman <<a href="mailto:derekf@osg.samsung.com">derekf@osg.samsung.com</a>><br>
<br>
Looks good to me - instead of trying to dereference the pointer in<br>
wl_resource_post_error() and crashing, now we'll clean up and kill the<br>
client connection in wl_client_create(), as we should.<br>
<br>
Thanks,<br>
Derek<br>
<span class="im HOEnZb"><br>
> ---<br>
> src/wayland-server.c | 3 ++-<br>
> 1 file changed, 2 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/wayland-server.c b/src/wayland-server.c<br>
> index 9e26b18..017a975 100644<br>
> --- a/src/wayland-server.c<br>
> +++ b/src/wayland-server.c<br>
> @@ -778,7 +778,8 @@ bind_display(struct wl_client *client, struct wl_display *display)<br>
> client->display_resource =<br>
> wl_resource_create(client, &wl_display_interface, 1, 1);<br>
> if (client->display_resource == NULL) {<br>
> - wl_client_post_no_memory(client);<br>
> + /* DON'T send no-memory error to client - it has no<br>
> + * resource to which it could post the event */<br>
> return -1;<br>
> }<br>
><br>
><br>
<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>