X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flp_ws.c;h=8df7153a3753ceb7604fd2df60c2ebb92508f6fe;hb=bd7adfc03ea691d16e4b8ba8edd40aa5459758e2;hp=74bcde5866c3e8224743a772053e4b464126cf7c;hpb=12b0e2c57c55b4d3086ef920deda5400016339f2;p=ppastats.git diff --git a/src/lp_ws.c b/src/lp_ws.c index 74bcde5..8df7153 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,7 +429,8 @@ struct daily_download_total **get_daily_download_totals(const char *binary_url) } free(key); - free(cached_ddts); + if (ddts != cached_ddts) + free(cached_ddts); free(retrieved_ddts); return ddts;