X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Fcore%2Fstore.c;h=a1cf8f6bc44b6ba816fc66ee729189c4371da07d;hp=ab37e689641ec52b42f844bb5f1f1d3cd6236d63;hb=2a0b199b7aac87fee49ebefe69d6f94a9045f4b8;hpb=c09b65cba8220b49bb25b1ba6c6ffd2f6e850583 diff --git a/src/core/store.c b/src/core/store.c index ab37e68..a1cf8f6 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -818,6 +818,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; @@ -844,6 +846,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; } @@ -861,13 +864,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