X-Git-Url: http://git.wpitchoune.net/gitweb/?p=ppastats.git;a=blobdiff_plain;f=src%2Flp_ws.c;h=3905a2813648a1ed525fdc7884a452cd40523bf5;hp=74bcde5866c3e8224743a772053e4b464126cf7c;hb=ffb8a406a1cf1b501dd3e3051e6028486c76f1e7;hpb=47415d6ef7b12572e99b59d18dc63e053fdb4f16 diff --git a/src/lp_ws.c b/src/lp_ws.c index 74bcde5..3905a28 100644 --- a/src/lp_ws.c +++ b/src/lp_ws.c @@ -393,10 +393,12 @@ 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); @@ -426,7 +428,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;