X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Ffrontend%2Fquery.c;h=2e2832469e8d2fed9beb2a405faa513f05edd09c;hp=4ae4f64a5e0a1373f5ff6ddfb416c277aa546f36;hb=bd0f5acb817a65984509ff648555fc65140873ba;hpb=07dada8e5c614f0ef90fed8e86183ba7acd0e6e8 diff --git a/src/frontend/query.c b/src/frontend/query.c index 4ae4f64..2e28324 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -248,7 +248,11 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu } if (status >= 0) { series = sdb_plugin_fetch_timeseries(st.type, st.id, &opts); - if (! series) { + if (series) { + sdb_timeseries_tojson(series, buf); + sdb_timeseries_destroy(series); + } + else { sdb_log(SDB_LOG_ERR, "frontend: Failed to fetch time-series '%s/%s' " "- %s fetcher callback returned no data for '%s'", ts->hostname, ts->metric, st.type, st.id); @@ -256,11 +260,6 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu } } - if (status >= 0) { - sdb_timeseries_tojson(series, buf); - sdb_timeseries_destroy(series); - } - free(fetch.hostname); free(fetch.name); if (st.type) @@ -477,7 +476,7 @@ sdb_conn_lookup(sdb_conn_t *conn) int sdb_conn_store(sdb_conn_t *conn) { - sdb_ast_node_t *ast; + sdb_ast_node_t *ast = NULL; const char *buf = sdb_strbuf_string(conn->buf); size_t len = conn->cmd_len; uint32_t type;