diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2011-09-05 18:24:07 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-09-06 12:20:04 +0200 |
commit | 2333126b3b5178e4670f01bfeaeec5948abb5546 (patch) | |
tree | 217239bbb18f5ca411bf86b46062e4e952924249 | |
parent | dfcdee310100fa0297f6d15dbadb673283c9a06a (diff) |
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 <andriy.shevchenko@linux.intel.com>
-rw-r--r-- | src/media.c | 3 |
1 files changed, 1 insertions, 2 deletions
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); |