X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flp_ws.c;h=64db1d7a39a3b0fb467bc9ea06d8178f2ec1b539;hb=eb26e5d2404df23c3151a55a6d887abb421ef601;hp=74bcde5866c3e8224743a772053e4b464126cf7c;hpb=12b0e2c57c55b4d3086ef920deda5400016339f2;p=ppastats.git diff --git a/src/lp_ws.c b/src/lp_ws.c index 74bcde5..64db1d7 100644 --- a/src/lp_ws.c +++ b/src/lp_ws.c @@ -393,13 +393,16 @@ struct daily_download_total **get_daily_download_totals(const char *binary_url) 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; @@ -426,8 +429,9 @@ struct daily_download_total **get_daily_download_totals(const char *binary_url) } 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; }