diff options
author | Bryce Harrington <bryce@osg.samsung.com> | 2014-11-20 22:21:55 -0800 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2014-11-28 16:05:39 +0200 |
commit | de44761a1a51a7fb79f7d239b802fd3f1660f744 (patch) | |
tree | efd5f9991f5cc5e81a2cda5c3a1bb9394457fc60 /src/screenshooter.c | |
parent | 2204492636cb4612952f28a163ee9599b15b7724 (diff) | |
download | weston-de44761a1a51a7fb79f7d239b802fd3f1660f744.tar.gz |
Use zalloc rather than malloc and manually setting members to 0
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'src/screenshooter.c')
-rw-r--r-- | src/screenshooter.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/screenshooter.c b/src/screenshooter.c index cafbf107..6246cda4 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -481,7 +481,7 @@ weston_recorder_create(struct weston_output *output, const char *filename) do_yflip = !!(compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP); - recorder = malloc(sizeof *recorder); + recorder = zalloc(sizeof *recorder); if (recorder == NULL) { weston_log("%s: out of memory\n", __func__); return; @@ -491,9 +491,6 @@ weston_recorder_create(struct weston_output *output, const char *filename) size = stride * 4 * output->current_mode->height; recorder->frame = zalloc(size); recorder->rect = malloc(size); - recorder->total = 0; - recorder->count = 0; - recorder->destroying = 0; recorder->output = output; if ((recorder->frame == NULL) || (recorder->rect == NULL)) { @@ -502,9 +499,7 @@ weston_recorder_create(struct weston_output *output, const char *filename) return; } - if (do_yflip) - recorder->tmpbuf = NULL; - else + if (!do_yflip) recorder->tmpbuf = malloc(size); header.magic = WCAP_HEADER_MAGIC; |