Changes allocation to calloc and {} as needed.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
regcomp(&pat_inittab, "([a-zA-Z0-9]*):([a-zA-Z0-9]*):([a-zA-Z0-9]*):(.*)", REG_EXTENDED);
line = malloc(LINE_LEN);
regcomp(&pat_inittab, "([a-zA-Z0-9]*):([a-zA-Z0-9]*):([a-zA-Z0-9]*):(.*)", REG_EXTENDED);
line = malloc(LINE_LEN);
- a = malloc(sizeof(struct init_action));
- memset(a, 0, sizeof(struct init_action));
+ a = calloc(1, sizeof(struct init_action));
while (fgets(line, LINE_LEN, fp)) {
char *tags[TAG_PROCESS + 1];
while (fgets(line, LINE_LEN, fp)) {
char *tags[TAG_PROCESS + 1];
if (add_action(a, tags[TAG_ACTION]))
continue;
line = malloc(LINE_LEN);
if (add_action(a, tags[TAG_ACTION]))
continue;
line = malloc(LINE_LEN);
- a = malloc(sizeof(struct init_action));
- memset(a, 0, sizeof(struct init_action));
+ a = calloc(1, sizeof(struct init_action));
- b = malloc(sizeof(*b));
+ b = calloc(1, sizeof(*b));
- memset(b, 0, sizeof(*b));
-
b->data = malloc(blob_pad_len(data));
b->name = strdup(name);
b->seen = timeout;
b->data = malloc(blob_pad_len(data));
b->name = strdup(name);
b->seen = timeout;
void hotplug(char *rules)
{
void hotplug(char *rules)
{
- struct sockaddr_nl nls;
+ struct sockaddr_nl nls = {};
int nlbufsize = 512 * 1024;
rule_file = strdup(rules);
int nlbufsize = 512 * 1024;
rule_file = strdup(rules);
- memset(&nls,0,sizeof(struct sockaddr_nl));
nls.nl_family = AF_NETLINK;
nls.nl_pid = getpid();
nls.nl_groups = -1;
nls.nl_family = AF_NETLINK;
nls.nl_pid = getpid();
nls.nl_groups = -1;