X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Fcore%2Fstore.c;h=eb58ad83b1ba2cd36b5fba803e42313758ea3d38;hp=ea30da90116d9925cd148e39f7577e346503ba42;hb=c2f7813397319e930c81c4f64b213bec64549167;hpb=32a9483322ca1462e9be6889f053d6ea3ed1e9df diff --git a/src/core/store.c b/src/core/store.c index ea30da9..eb58ad8 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -850,6 +850,8 @@ sdb_store_fetch_timeseries(const char *hostname, const char *metric, sdb_timeseries_t *ts; + int status = 0; + if ((! hostname) || (! metric) || (! opts) || (! buf)) return -1; @@ -876,6 +878,7 @@ sdb_store_fetch_timeseries(const char *hostname, const char *metric, sdb_log(SDB_LOG_ERR, "store: Failed to fetch time-series '%s/%s' " "- no data-store configured for the stored metric", hostname, metric); + sdb_object_deref(SDB_OBJ(m)); pthread_rwlock_unlock(&host_lock); return -1; } @@ -893,13 +896,14 @@ sdb_store_fetch_timeseries(const char *hostname, const char *metric, sdb_log(SDB_LOG_ERR, "store: Failed to fetch time-series '%s/%s' " "- %s fetcher callback returned no data for '%s'", hostname, metric, type, id); - return -1; + status = -1; } } ts_tojson(ts, buf); + sdb_object_deref(SDB_OBJ(m)); sdb_timeseries_destroy(ts); - return 0; + return status; } /* sdb_store_fetch_timeseries */ int