normalize #include
[ppastats.git] / src / lp_ws.c
index 3905a28..74d63c7 100644 (file)
 
 #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. */
@@ -402,6 +402,7 @@ struct daily_download_total **get_daily_download_totals(const char *binary_url)
 
        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;
@@ -429,8 +430,8 @@ struct daily_download_total **get_daily_download_totals(const char *binary_url)
 
        free(key);
        if (ddts != cached_ddts)
-               free(cached_ddts);
-       free(retrieved_ddts);
+               daily_download_total_list_free(cached_ddts);
+       daily_download_total_list_free(retrieved_ddts);
 
        return ddts;
 }