changeset 36389:3961f6dd9dff

Use sizeof(*var) instead of sizeof(type), prefer calloc.
author reimar
date Fri, 25 Oct 2013 19:59:57 +0000
parents 542cf5882264
children ac6843fb4f01
files libmpcodecs/ad_mpg123.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_mpg123.c	Fri Oct 25 19:59:56 2013 +0000
+++ b/libmpcodecs/ad_mpg123.c	Fri Oct 25 19:59:57 2013 +0000
@@ -84,8 +84,7 @@
     if (mpg123_init() != MPG123_OK)
         return 0;
 
-    sh->context = malloc(sizeof(struct ad_mpg123_context));
-    con = sh->context;
+    sh->context = con = calloc(sizeof(*con), 1);
     /* Auto-choice of optimized decoder (first argument NULL). */
     con->handle = mpg123_new(NULL, &err);
     if (!con->handle)