return -EINVAL;
}
- g_ctx.hw_events = calloc(ci->values_num, sizeof(char *));
+ g_ctx.hw_events = calloc(ci->values_num, sizeof(*g_ctx.hw_events));
if (g_ctx.hw_events == NULL) {
ERROR(PMU_PLUGIN ": Failed to allocate hw events.");
return -ENOMEM;
/* Allocate memory for event struct that contains array of efd structs
for all cores */
struct event *e =
- calloc(sizeof(struct event) + sizeof(struct efd) * el->num_cpus, 1);
+ calloc(1, sizeof(struct event) + sizeof(struct efd) * el->num_cpus);
if (e == NULL) {
ERROR(PMU_PLUGIN ": Failed to allocate event structure");
return -ENOMEM;
/* Allocate memory for event struct that contains array of efd structs
for all cores */
struct event *e =
- calloc(sizeof(struct event) + sizeof(struct efd) * el->num_cpus, 1);
+ calloc(1, sizeof(struct event) + sizeof(struct efd) * el->num_cpus);
if (e == NULL) {
free(events);
return -ENOMEM;