aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/influxdb-reader.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-05-16 00:37:34 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-10 23:41:14 +0200
commitc8d0593d6495e87603806ada76a399500cdc2831 (patch)
treed0d9dc88a43ab30a3712a7946d21baea837bebfb /src/plugins/influxdb-reader.c
parent4f40dc104633e44d3b021fafb1057b7669616926 (diff)
Fix memory leak and avoid compile warning
Change-Id: Ib0bcba9daad456f63c0ea704e1fa87f44b6acc98 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/plugins/influxdb-reader.c')
-rw-r--r--src/plugins/influxdb-reader.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/plugins/influxdb-reader.c b/src/plugins/influxdb-reader.c
index b6bef25..a1fa3a0 100644
--- a/src/plugins/influxdb-reader.c
+++ b/src/plugins/influxdb-reader.c
@@ -91,7 +91,6 @@ static void unpack_metric_from_db(void *ml, json_object *metricJ)
wrap_json_array_for_all(columnsJ, fill_key, m_list);
wrap_json_array_for_all(valuesJ, fill_n_send_values, m_list);
-
}
static json_object *unpack_series(json_object *seriesJ)
@@ -176,7 +175,7 @@ static CURL *make_curl_query_get(const char *url)
args[0] = "epoch";
args[1] = "ns";
args[2] = "q";
- strncat(query, "SELECT * FROM /^.*$/", strlen("SELECT * FROM /^.*$/"));
+ strcat(query, "SELECT * FROM /^.*$/");
args[4] = NULL;
length_now = asprintf(&now, "%lu", get_ts());
@@ -192,7 +191,7 @@ static CURL *make_curl_query_get(const char *url)
AFB_ERROR("Error writing last_db_read file: %s\n", strerror( errno ));
}
else {
- strncat(query, " WHERE time >= ", strlen(" WHERE time >= "));
+ strcat(query, " WHERE time >= ");
strncat(query, last_ts, strlen(last_ts));
close(fd_last_read);
fd_last_read = openat(rootdir_fd, "last_db_read", O_TRUNC | O_RDWR);