<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 1, 2015 at 6:35 AM, Bryce Harrington <span dir="ltr"><<a href="mailto:bryce@osg.samsung.com" target="_blank">bryce@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">Signed-off-by: Bryce Harrington <<a href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>><br>
---<br>
 xwayland/selection.c | 10 +++++++---<br>
 1 file changed, 7 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/xwayland/selection.c b/xwayland/selection.c<br>
index 572a0b5..451b915 100644<br>
--- a/xwayland/selection.c<br>
+++ b/xwayland/selection.c<br>
@@ -119,8 +119,9 @@ weston_wm_get_incr_chunk(struct weston_wm *wm)<br>
        } else {<br>
                weston_log("transfer complete\n");<br>
                close(wm->data_source_fd);<br>
-               free(reply);<br>
        }<br>
+<br>
+       free(reply);<br>
 }<br>
<br>
 struct x11_data_source {<br>
@@ -192,8 +193,10 @@ weston_wm_get_selection_targets(struct weston_wm *wm)<br>
        }<br>
<br>
        source = malloc(sizeof *source);<br>
-       if (source == NULL)<br>
+       if (source == NULL) {<br>
+               free(reply);<br>
                return;<br>
+       }<br>
<br>
        wl_signal_init(&source->base.destroy_signal);<br>
        source->base.accept = data_source_accept;<br>
@@ -237,12 +240,13 @@ weston_wm_get_selection_data(struct weston_wm *wm)<br>
        if (reply->type == wm->atom.incr) {<br>
                dump_property(wm, wm->atom.wl_selection, reply);<br>
                wm->incr = 1;<br>
-               free(reply);<br>
        } else {<br>
                dump_property(wm, wm->atom.wl_selection, reply);<br>
                wm->incr = 0;<br>
                weston_wm_write_property(wm, reply);<br>
        }<br>
+<br>
+       free(reply);<br>
 }<br>
<br>
 static void<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Just wondering: does xcb_get_property_reply always return non-NULL? Because there's no check for that before dereferencing the reply.<br><br></div><div class="gmail_extra">Reviewed-by: Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>><br></div></div>