<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 21 November 2014 at 07:21, 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>
 src/clipboard.c     | 5 +++--<br>
 src/screenshooter.c | 9 ++-------<br>
 2 files changed, 5 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/clipboard.c b/src/clipboard.c<br>
index 5a3a02d..dbd8c9b 100644<br>
--- a/src/clipboard.c<br>
+++ b/src/clipboard.c<br>
@@ -214,9 +214,10 @@ clipboard_client_create(struct clipboard_source *source, int fd)<br>
        struct wl_event_loop *loop =<br>
                wl_display_get_event_loop(seat->compositor->wl_display);<br>
<br>
-       client = malloc(sizeof *client);<br>
+       client = zalloc(sizeof *client);<br>
+       if (client == NULL)<br>
+               return;<br>
<br>
-       client->offset = 0;<br>
        client->source = source;<br>
        source->refcount++;<br>
        client->event_source =<br>
diff --git a/src/screenshooter.c b/src/screenshooter.c<br>
index cafbf10..6246cda 100644<br>
--- a/src/screenshooter.c<br>
+++ b/src/screenshooter.c<br>
@@ -481,7 +481,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)<br>
<br>
        do_yflip = !!(compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP);<br>
<br>
-       recorder = malloc(sizeof *recorder);<br>
+       recorder = zalloc(sizeof *recorder);<br>
        if (recorder == NULL) {<br>
                weston_log("%s: out of memory\n", __func__);<br>
                return;<br>
@@ -491,9 +491,6 @@ weston_recorder_create(struct weston_output *output, const char *filename)<br>
        size = stride * 4 * output->current_mode->height;<br>
        recorder->frame = zalloc(size);<br>
        recorder->rect = malloc(size);<br>
-       recorder->total = 0;<br>
-       recorder->count = 0;<br>
-       recorder->destroying = 0;<br>
        recorder->output = output;<br>
<br>
        if ((recorder->frame == NULL) || (recorder->rect == NULL)) {<br>
@@ -502,9 +499,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)<br>
                return;<br>
        }<br>
<br>
-       if (do_yflip)<br>
-               recorder->tmpbuf = NULL;<br>
-       else<br>
+       if (!do_yflip)<br>
                recorder->tmpbuf = malloc(size);<br></blockquote><div><br></div><div>Here you don't check the malloc's result. Also in weston_recorder_destroy there's no check that tmpbuf was allocated before freeing that memory.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
        header.magic = WCAP_HEADER_MAGIC;<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" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Thanks,<br>Marek<br></div></div>