<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 12:31 PM, Nils Chr. Brause <span dir="ltr"><<a href="mailto:nilschrbrause@gmail.com" target="_blank">nilschrbrause@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Up until now, newly created wl_proxys (with proxy_create or<br>
wl_proxy_create_for_id) are not initialized properly after memory<br>
allocation. The wl_display object in contrast is. To prevent giving<br>
uninitialized data to the user (e.g. user_data) an appropriate memset<br>
has been added.<br>
<br>
Signed-off-by: Nils Chr. Brause <<a href="mailto:nilschrbrause@googlemail.com">nilschrbrause@googlemail.com</a>><br>
---<br>
src/wayland-client.c | 4 ++++<br>
1 file changed, 4 insertions(+)<br>
<br>
diff --git a/src/wayland-client.c b/src/wayland-client.c<br>
index 3e401d3..8006581 100644<br>
--- a/src/wayland-client.c<br>
+++ b/src/wayland-client.c<br>
@@ -274,6 +274,8 @@ proxy_create(struct wl_proxy *factory, const struct<br>
wl_interface *interface)<br>
if (proxy == NULL)<br>
return NULL;<br>
<br>
+ memset(proxy, 0, sizeof *proxy);<br>
+<br>
proxy->object.interface = interface;<br>
proxy->object.implementation = NULL;<br>
proxy->dispatcher = NULL;<br></blockquote><div><br></div><div>I'm not a fan of this patch because it does a memset, and then a few lines later, explicitly sets pointers to NULL. If you want a memset, you should also remove the explicit NULL sets.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@@ -331,6 +333,8 @@ wl_proxy_create_for_id(struct wl_proxy *factory,<br>
if (proxy == NULL)<br>
return NULL;<br>
<br>
+ memset(proxy, 0, sizeof *proxy);<br>
+<br>
proxy->object.interface = interface;<br>
proxy->object.implementation = NULL;<br>
proxy-><a href="http://object.id" target="_blank">object.id</a> = id;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.4<br>
<br>
_______________________________________________<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" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br> Jasper<br>
</div></div>