[MPlayer-dev-eng] [PATCH 3/3] Use sizeof(*var) instead of sizeof(type), prefer calloc.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Oct 15 20:44:49 CEST 2013


---
 libmpcodecs/ad_mpg123.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libmpcodecs/ad_mpg123.c b/libmpcodecs/ad_mpg123.c
index 26a5d27..6a24e62 100644
--- a/libmpcodecs/ad_mpg123.c
+++ b/libmpcodecs/ad_mpg123.c
@@ -84,8 +84,7 @@ static int preinit(sh_audio_t *sh)
     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)
-- 
1.8.4.rc3



More information about the MPlayer-dev-eng mailing list