mirror of git://git.suckless.org/sbase
Use calloc() instead of malloc() + memset()
This commit is contained in:
parent
471432a9e6
commit
9a4fba0251
3
insmod.c
3
insmod.c
|
@ -51,10 +51,9 @@ main(int argc, char *argv[])
|
||||||
plen += strlen(argv[i]);
|
plen += strlen(argv[i]);
|
||||||
if (plen > 0) {
|
if (plen > 0) {
|
||||||
plen += argc;
|
plen += argc;
|
||||||
opts = malloc(plen);
|
opts = calloc(1, plen);
|
||||||
if (!opts)
|
if (!opts)
|
||||||
eprintf("malloc:");
|
eprintf("malloc:");
|
||||||
memset(opts, 0, plen);
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
strcat(opts, argv[i]);
|
strcat(opts, argv[i]);
|
||||||
if (i + 1 < argc)
|
if (i + 1 < argc)
|
||||||
|
|
Loading…
Reference in New Issue