# HG changeset patch # User cehoyos # Date 1285837835 0 # Node ID 3661c193c3ba08135b6ec0db0ea18a713c6b136d # Parent acbe908638b27a12f76a8506e2a0011ad1012d27 Use calloc instead of malloc and memset. Patch by Clment Bsch, ubitux gmail diff -r acbe908638b2 -r 3661c193c3ba subreader.c --- a/subreader.c Thu Sep 30 09:08:37 2010 +0000 +++ b/subreader.c Thu Sep 30 09:10:35 2010 +0000 @@ -1925,8 +1925,7 @@ tmpresult = malloc(len); - result = malloc(sizeof(subfn)*MAX_SUBTITLE_FILES); - memset(result, 0, sizeof(subfn)*MAX_SUBTITLE_FILES); + result = calloc(MAX_SUBTITLE_FILES, sizeof(*result)); subcnt = 0; @@ -2064,8 +2063,7 @@ qsort(result, subcnt, sizeof(subfn), compare_sub_priority); - result2 = malloc(sizeof(char*)*(subcnt+1)); - memset(result2, 0, sizeof(char*)*(subcnt+1)); + result2 = calloc(subcnt + 1, sizeof(*result2)); for (i = 0; i < subcnt; i++) { result2[i] = result[i].fname;