X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_sensu.c;h=6e6517bdf845cdd836fd76ae36c5f86ba21a7e68;hb=4d3d0c9713859c9edd7cd88b5ef786e3630a846c;hp=c0c06347d4c6483db9aaaca3ab4a693b3899fc2e;hpb=c3d354c58d56c4b2bb4138a227f3546928bd84f2;p=collectd.git diff --git a/src/write_sensu.c b/src/write_sensu.c index c0c06347..6e6517bd 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -132,7 +132,7 @@ static int add_str_to_list(struct str_list *strs, ERROR("write_sensu plugin: Unable to alloc memory"); return -1; } - strs->strs = realloc(strs->strs, sizeof(char *) * (strs->nb_strs + 1)); + strs->strs = realloc(strs->strs, strs->nb_strs + 1); if (strs->strs == NULL) { strs->strs = old_strs_ptr; free(newstr); @@ -231,7 +231,7 @@ static char *build_json_str_list(const char *tag, char *ret_str = NULL; char *temp_str; if (list->nb_strs == 0) { - ret_str = malloc(sizeof(char)); + ret_str = malloc(1); if (ret_str == NULL) { ERROR("write_sensu plugin: Unable to alloc memory"); return NULL;