Bug fix - house, aspect and antiscia lists were not freed correctly

After calling g_list_free_full(), the list must be set to NULL.
This commit is contained in:
Gergely Polonkai 2013-09-18 21:55:49 +02:00
parent 984ed5d527
commit 5b0a2b33c1

View File

@ -535,6 +535,8 @@ gswe_moment_calculate_house_positions(GsweMoment *moment, GError **err)
if ((house_data->sign = g_hash_table_lookup(gswe_sign_info_table, GINT_TO_POINTER((gint)ceilf(cusps[i] / 30.0)))) == NULL) { if ((house_data->sign = g_hash_table_lookup(gswe_sign_info_table, GINT_TO_POINTER((gint)ceilf(cusps[i] / 30.0)))) == NULL) {
g_list_free_full(moment->priv->house_list, g_free); g_list_free_full(moment->priv->house_list, g_free);
moment->priv->house_list = NULL;
moment->priv->house_revision = 0;
g_set_error(err, GSWE_MOMENT_ERROR, GSWE_MOMENT_ERROR_UNKNOWN_SIGN, "Calculation brought an unknown sign"); g_set_error(err, GSWE_MOMENT_ERROR, GSWE_MOMENT_ERROR_UNKNOWN_SIGN, "Calculation brought an unknown sign");
return; return;
@ -1061,6 +1063,7 @@ gswe_moment_calculate_aspects(GsweMoment *moment)
gswe_moment_calculate_all_planets(moment); gswe_moment_calculate_all_planets(moment);
g_list_free_full(moment->priv->aspect_list, g_free); g_list_free_full(moment->priv->aspect_list, g_free);
moment->priv->aspect_list = NULL;
for (oplanet = moment->priv->planet_list; oplanet; oplanet = oplanet->next) { for (oplanet = moment->priv->planet_list; oplanet; oplanet = oplanet->next) {
for (iplanet = moment->priv->planet_list; iplanet; iplanet = iplanet->next) { for (iplanet = moment->priv->planet_list; iplanet; iplanet = iplanet->next) {
@ -1215,6 +1218,7 @@ gswe_moment_calculate_antiscia(GsweMoment *moment)
gswe_moment_calculate_all_planets(moment); gswe_moment_calculate_all_planets(moment);
g_list_free_full(moment->priv->antiscia_list, g_free); g_list_free_full(moment->priv->antiscia_list, g_free);
moment->priv->antiscia_list = NULL;
for (oplanet = moment->priv->planet_list; oplanet; oplanet = oplanet->next) { for (oplanet = moment->priv->planet_list; oplanet; oplanet = oplanet->next) {
for (iplanet = moment->priv->planet_list; iplanet; iplanet = iplanet->next) { for (iplanet = moment->priv->planet_list; iplanet; iplanet = iplanet->next) {