/*
- * Copyright (C) 2011-2014 jeanfi@gmail.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
+ Copyright (C) 2011-2014 jeanfi@gmail.com
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA
*/
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
-#include "list.h"
-#include "lp_ws.h"
+#include <list.h>
+#include <lp_ws.h>
#include <plog.h>
-#include "ppastats.h"
+#include <ppastats.h>
static struct package_stats *get_package_stats(struct ppa_stats *stats,
const char *name)
pkg_distro = distro_stats_new(distro_name);
tmp = (struct distro_stats **)list_add((void **)pkg->distros,
(void *)pkg_distro);
- free(pkg->distros);
+ if (pkg->distros != tmp)
+ free(pkg->distros);
pkg->distros = tmp;
}
distro_stats_free(*distros);
distros++;
}
+ free(distros);
}
}
static void version_stats_free(struct version_stats *version)
{
- struct distro_stats **distros;
-
- distros = version->distros;
- if (distros) {
- while (*distros) {
- distro_stats_free(*distros);
- distros++;
- }
- free(version->distros);
- }
-
+ distro_stats_list_free(version->distros);
daily_download_total_list_free(version->daily_download_totals);
free(version->version);