X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdbi.c;h=a61f66bc606601ddb6426c42c0b0b1e52efc73af;hb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;hp=a965b071bdd1d362f5d3512332fa6fa6a50ace14;hpb=9f77f493ef7cf6077deaa2385d2392d144cf606f;p=collectd.git diff --git a/src/dbi.c b/src/dbi.c index a965b071..a61f66bc 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -54,7 +54,7 @@ struct cdbi_driver_option_s /* {{{ */ char *string; int numeric; } value; - _Bool is_numeric; + bool is_numeric; }; typedef struct cdbi_driver_option_s cdbi_driver_option_t; /* }}} */ @@ -188,7 +188,10 @@ static void cdbi_database_free(cdbi_database_t *db) /* {{{ */ if (db->q_prep_areas) for (size_t i = 0; i < db->queries_num; ++i) udb_query_delete_preparation_area(db->q_prep_areas[i]); - free(db->q_prep_areas); + sfree(db->q_prep_areas); + /* N.B.: db->queries references objects "owned" by the global queries + * variable. Free the array here, but not the content. */ + sfree(db->queries); sfree(db); } /* }}} void cdbi_database_free */ @@ -494,8 +497,8 @@ static int cdbi_read_database_query(cdbi_database_t *db, /* {{{ */ } column_num = (size_t)db_status; - DEBUG("cdbi_read_database_query (%s, %s): There are %zu columns.", db->name, - udb_query_get_name(q), column_num); + DEBUG("cdbi_read_database_query (%s, %s): There are %" PRIsz " columns.", + db->name, udb_query_get_name(q), column_num); } /* Allocate `column_names' and `column_values'. {{{ */ @@ -536,7 +539,7 @@ static int cdbi_read_database_query(cdbi_database_t *db, /* {{{ */ column_name = dbi_result_get_field_name(res, (unsigned int)(i + 1)); if (column_name == NULL) { ERROR("dbi plugin: cdbi_read_database_query (%s, %s): " - "Cannot retrieve name of field %zu.", + "Cannot retrieve name of field %" PRIsz ".", db->name, udb_query_get_name(q), i + 1); BAIL_OUT(-1); } @@ -576,7 +579,7 @@ static int cdbi_read_database_query(cdbi_database_t *db, /* {{{ */ if (status != 0) { ERROR("dbi plugin: cdbi_read_database_query (%s, %s): " - "cdbi_result_get_field (%zu) failed.", + "cdbi_result_get_field (%" PRIsz ") failed.", db->name, udb_query_get_name(q), i + 1); status = -1; break;