Skip to content

Commit

Permalink
snmpstats: fix typo in pointer allocation
Browse files Browse the repository at this point in the history
Fixes coverity tag 150522
  • Loading branch information
razvancrainea committed Oct 21, 2016
1 parent 8bc93d3 commit 6017c7d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/snmpstats/snmpstats.c
Expand Up @@ -178,10 +178,10 @@ static int register_message_code_statistics(void)
sizeof(in_message_code_names) / sizeof(char *);

in_message_code_stats =
shm_malloc(sizeof(stat_var) * number_of_message_codes);
shm_malloc(sizeof(stat_var *) * number_of_message_codes);

out_message_code_stats =
shm_malloc(sizeof(stat_var) * number_of_message_codes);
shm_malloc(sizeof(stat_var *) * number_of_message_codes);

/* We can only proceed if we had enough memory to allocate the
* statistics. Note that we don't free the memory, but we don't care
Expand All @@ -193,8 +193,10 @@ static int register_message_code_statistics(void)
}

/* Make sure everything is zeroed out */
memset(in_message_code_stats, 0, number_of_message_codes);
memset(out_message_code_stats, 0, number_of_message_codes);
memset(in_message_code_stats, 0,
number_of_message_codes * sizeof(stat_var *));
memset(out_message_code_stats, 0,
number_of_message_codes * sizeof(stat_var *));

for (i = 0; i < number_of_message_codes; i++)
{
Expand Down

0 comments on commit 6017c7d

Please sign in to comment.