#include <json.h>
-#include "cache.h"
-#include "fcache.h"
-#include "http.h"
-#include "list.h"
-#include "lp_ws.h"
-#include "lp_json.h"
+#include <cache.h>
+#include <fcache.h>
+#include <http.h>
+#include <list.h>
+#include <lp_ws.h>
+#include <lp_json.h>
#include <plog.h>
-#include "ppastats.h"
+#include <ppastats.h>
#include <ptime.h>
/** Default ws.size value for the getPublishedBinaries request. */
key = get_ddts_list_cache_key(binary_url);
content = fcache_get(key);
- if (content)
+ if (content) {
json = json_tokener_parse(content);
- else
+ free(content);
+ } else {
json = NULL;
+ }
if (json) {
cached_ddts = json_object_to_daily_download_totals(json);
+ json_object_put(json);
last_t = ddts_get_last_date(cached_ddts);
} else {
last_t = 0;
}
free(key);
- free(cached_ddts);
- free(retrieved_ddts);
+ if (ddts != cached_ddts)
+ daily_download_total_list_free(cached_ddts);
+ daily_download_total_list_free(retrieved_ddts);
return ddts;
}