From 2333126b3b5178e4670f01bfeaeec5948abb5546 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 5 Sep 2011 18:24:07 +0300 Subject: libmediactl: get rid of memset via using calloc The code snippet x = malloc(sizeof(*x)); memset(x, 0, sizeof(*x)); could be easily changed to x = calloc(1, sizeof(*x)); Signed-off-by: Andy Shevchenko --- src/media.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/media.c b/src/media.c index 099e77e..f443d0c 100644 --- a/src/media.c +++ b/src/media.c @@ -410,12 +410,11 @@ struct media_device *media_open(const char *name, int verbose) struct media_device *media; int ret; - media = malloc(sizeof(*media)); + media = calloc(1, sizeof(*media)); if (media == NULL) { printf("%s: unable to allocate memory\n", __func__); return NULL; } - memset(media, 0, sizeof(*media)); if (verbose) printf("Opening media device %s\n", name); -- cgit v1.2.3