Use calloc() instead of malloc() + memset()

This commit is contained in:
sin 2014-02-10 19:28:39 +00:00
parent 471432a9e6
commit 9a4fba0251
1 changed files with 1 additions and 2 deletions

View File

@ -51,10 +51,9 @@ main(int argc, char *argv[])
plen += strlen(argv[i]);
if (plen > 0) {
plen += argc;
opts = malloc(plen);
opts = calloc(1, plen);
if (!opts)
eprintf("malloc:");
memset(opts, 0, plen);
for (i = 0; i < argc; i++) {
strcat(opts, argv[i]);
if (i + 1 < argc)