projects
/
media-ctl.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dfcdee3
)
libmediactl: get rid of memset via using calloc
author
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 5 Sep 2011 15:24:07 +0000
(18:24 +0300)
committer
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 6 Sep 2011 10:20:04 +0000
(12:20 +0200)
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>
src/media.c
patch
|
blob
|
history
diff --git
a/src/media.c
b/src/media.c
index
099e77e
..
f443d0c
100644
(file)
--- 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);