diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-15 09:20:41 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-15 09:22:36 -0800 |
commit | f3e48a4a0435ae17cff0b570d208a222fcd7fc58 (patch) | |
tree | 7719d121ee713def6d511863c69120723f28ad1b | |
parent | 343b595d28a2808f08c99faabbde2d999e43b5e7 (diff) |
Replace malloc()+memset() with calloc()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | src/smi_video.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/smi_video.c b/src/smi_video.c index 055f606..62de55d 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -552,25 +552,24 @@ SMI_BuildEncodings(SMI_PortPtr p) ENTER(); /* allocate memory for encoding array */ - p->enc = malloc(sizeof(XF86VideoEncodingRec) * N_ENCODINGS); + p->enc = calloc(N_ENCODINGS, sizeof(XF86VideoEncodingRec)); if (NULL == p->enc) goto fail; - memset(p->enc,0,sizeof(XF86VideoEncodingRec) * N_ENCODINGS); + /* allocate memory for video norm array */ - p->norm = malloc(sizeof(int) * N_ENCODINGS); + p->norm = calloc(N_ENCODINGS, sizeof(int)); if (NULL == p->norm) goto fail; - memset(p->norm,0,sizeof(int) * N_ENCODINGS); + /* allocate memory for video input format array */ - p->input = malloc(sizeof(int) * N_ENCODINGS); + p->input = calloc(N_ENCODINGS, sizeof(int)); if (NULL == p->input) goto fail; - memset(p->input,0,sizeof(int) * N_ENCODINGS); + /* allocate memory for video channel number array */ - p->channel = malloc(sizeof(int) * N_ENCODINGS); + p->channel = calloc(N_ENCODINGS, sizeof(int)); if (NULL == p->channel) goto fail; - memset(p->channel,0,sizeof(int) * N_ENCODINGS); /* fill arrays */ p->nenc = 0; |