summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2abb98e)
raw | patch | inline | side by side (parent: 2abb98e)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 14:00:53 +0000 (16:00 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 1 Apr 2016 14:00:53 +0000 (16:00 +0200) |
src/exec.c | patch | blob | history |
diff --git a/src/exec.c b/src/exec.c
index 4c45dc158a267951cde5a8d608fe25be905f0a61..85f6cb8038a21b12a0db63668164b3585d885577 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
return (-1);
}
- pl = malloc (sizeof (*pl));
+ pl = calloc (1, sizeof (*pl));
if (pl == NULL)
{
- ERROR ("exec plugin: malloc failed.");
+ ERROR ("exec plugin: calloc failed.");
return (-1);
}
- memset (pl, '\0', sizeof (program_list_t));
if (strcasecmp ("NotificationExec", ci->key) == 0)
pl->flags |= PL_NOTIF_ACTION;
return (-1);
}
- pl->argv = malloc (ci->values_num * sizeof (*pl->argv));
+ pl->argv = calloc (ci->values_num, sizeof (*pl->argv));
if (pl->argv == NULL)
{
- ERROR ("exec plugin: malloc failed.");
+ ERROR ("exec plugin: calloc failed.");
sfree (pl->exec);
sfree (pl->user);
sfree (pl);
return (-1);
}
- memset (pl->argv, '\0', ci->values_num * sizeof (char *));
{
char *tmp = strrchr (ci->values[1].value.string, '/');
pl->argv[0] = strdup (buffer);
if (pl->argv[0] == NULL)
{
- ERROR ("exec plugin: malloc failed.");
+ ERROR ("exec plugin: strdup failed.");
sfree (pl->argv);
sfree (pl->exec);
sfree (pl->user);