From: Ruben Kerkhof Date: Mon, 28 Mar 2016 17:24:17 +0000 (+0200) Subject: treewide: fix a few error messages X-Git-Tag: collectd-5.6.0~371^2~53 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2facdd7eef91949c1594f06703afeb6dd87e51cc;p=collectd.git treewide: fix a few error messages Don't log that malloc failed when we call calloc --- diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c index 49e84f35..712c24fa 100644 --- a/src/collectd-nagios.c +++ b/src/collectd-nagios.c @@ -136,14 +136,14 @@ static int filter_ds (size_t *values_num, new_values = (gauge_t *)calloc (match_ds_num_g, sizeof (*new_values)); if (new_values == NULL) { - fprintf (stderr, "malloc failed: %s\n", strerror (errno)); + fprintf (stderr, "calloc failed: %s\n", strerror (errno)); return (RET_UNKNOWN); } new_names = (char **)calloc (match_ds_num_g, sizeof (*new_names)); if (new_names == NULL) { - fprintf (stderr, "malloc failed: %s\n", strerror (errno)); + fprintf (stderr, "calloc failed: %s\n", strerror (errno)); free (new_values); return (RET_UNKNOWN); } diff --git a/src/mqtt.c b/src/mqtt.c index 4977f684..0b00bab8 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -559,7 +559,7 @@ static int mqtt_config_publisher (oconfig_item_t *ci) conf = calloc (1, sizeof (*conf)); if (conf == NULL) { - ERROR ("mqtt plugin: malloc failed."); + ERROR ("mqtt plugin: calloc failed."); return (-1); } conf->publish = 1; @@ -664,7 +664,7 @@ static int mqtt_config_subscriber (oconfig_item_t *ci) conf = calloc (1, sizeof (*conf)); if (conf == NULL) { - ERROR ("mqtt plugin: malloc failed."); + ERROR ("mqtt plugin: calloc failed."); return (-1); } conf->publish = 0; diff --git a/src/oracle.c b/src/oracle.c index 84d9ed49..fedefd09 100644 --- a/src/oracle.c +++ b/src/oracle.c @@ -273,7 +273,7 @@ static int o_config_add_database (oconfig_item_t *ci) /* {{{ */ if (db->q_prep_areas == NULL) { - WARNING ("oracle plugin: malloc failed"); + WARNING ("oracle plugin: calloc failed"); status = -1; break; } diff --git a/src/redis.c b/src/redis.c index 4e3de56c..919a8312 100644 --- a/src/redis.c +++ b/src/redis.c @@ -130,7 +130,7 @@ static redis_query_t *redis_config_query (oconfig_item_t *ci) /* {{{ */ rq = calloc(1, sizeof(*rq)); if (rq == NULL) { - ERROR("redis plugin: calloca failed adding redis_query."); + ERROR("redis plugin: calloc failed adding redis_query."); return NULL; } status = cf_util_get_string_buffer(ci, rq->query, sizeof(rq->query)); diff --git a/src/utils_db_query.c b/src/utils_db_query.c index d003e7fa..de435cb4 100644 --- a/src/utils_db_query.c +++ b/src/utils_db_query.c @@ -207,7 +207,7 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */ vl.values = (value_t *) calloc (r->values_num, sizeof (value_t)); if (vl.values == NULL) { - ERROR ("db query utils: malloc failed."); + ERROR ("db query utils: calloc failed."); return (-1); } vl.values_len = r_area->ds->ds_num; @@ -390,7 +390,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (size_t *) calloc (r->instances_num, sizeof (size_t)); if (prep_area->instances_pos == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); } @@ -398,7 +398,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (char **) calloc (r->instances_num, sizeof (char *)); if (prep_area->instances_buffer == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); } } /* if (r->instances_num > 0) */ @@ -407,7 +407,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (size_t *) calloc (r->values_num, sizeof (size_t)); if (prep_area->values_pos == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); } @@ -415,7 +415,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (char **) calloc (r->values_num, sizeof (char *)); if (prep_area->values_buffer == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); } @@ -423,7 +423,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (size_t *) calloc (r->metadata_num, sizeof (size_t)); if (prep_area->metadata_pos == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); } @@ -431,7 +431,7 @@ static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */ = (char **) calloc (r->metadata_num, sizeof (char *)); if (prep_area->metadata_buffer == NULL) { - ERROR ("db query utils: udb_result_prepare_result: malloc failed."); + ERROR ("db query utils: udb_result_prepare_result: calloc failed."); BAIL_OUT (-ENOMEM); }