summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0672b1d)
raw | patch | inline | side by side (parent: 0672b1d)
author | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 12:07:26 +0000 (13:07 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 12:07:26 +0000 (13:07 +0100) |
CID: 38019
src/postgresql.c | patch | blob | history |
diff --git a/src/postgresql.c b/src/postgresql.c
index 78f6fe574c2428f523532dde74b911547d58696f..e46a47110ad7978d5154796aaed4d7b0dbefea2c 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
data = udb_query_get_user_data (q);
if (NULL == data) {
- data = (c_psql_user_data_t *) malloc (sizeof (*data));
+ data = malloc (sizeof (*data));
if (NULL == data) {
log_err ("Out of memory.");
return -1;
}
memset (data, 0, sizeof (*data));
data->params = NULL;
+ data->params_num = 0;
+
+ udb_query_set_user_data (q, data);
}
- tmp = (c_psql_param_t *) realloc (data->params,
- (data->params_num + 1) * sizeof (c_psql_param_t));
+ tmp = realloc (data->params, (data->params_num + 1) * sizeof (*data->params));
if (NULL == tmp) {
log_err ("Out of memory.");
return -1;
}
data->params_num++;
- udb_query_set_user_data (q, data);
-
return (0);
} /* config_query_param_add */