summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-10-02 00:35:09 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-01 20:53:52 -0700
commit7f01b91c991e67a2a1a20a75a3ff01ad4fa6d975 (patch)
treee80659ca55c7bf9e3ed7279c764881a7ee19b704 /divelist.c
parent73f290be8fa83de71ed1db8a9a8c8fa06432f8eb (diff)
downloadsubsurface-7f01b91c991e67a2a1a20a75a3ff01ad4fa6d975.tar.gz
Fixed memory leaks specific to divelist.c
move_dive_between_trips() always returns a pointer to a new allocated memory block of size = GtkTreeIter. Lets free said memory when no longer needed in the caller functions. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c
index 05e46bc93..2d6c6fdcf 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1519,7 +1519,7 @@ static void merge_dive_into_trip_above_cb(GtkWidget *menuitem, GtkTreePath *path
* stamp that we fall back to when toggling autogroup */
dive->divetrip->when_from_file = dive->divetrip->when;
dive->tripflag = IN_TRIP;
- (void)move_dive_between_trips(&dive_iter, NULL, &trip_iter, NULL, TRUE);
+ free(move_dive_between_trips(&dive_iter, NULL, &trip_iter, NULL, TRUE));
prev_dive = dive;
/* by merging the dive into the trip above the path now points to the next
top level entry. If that iter exists, it's also a dive and both this dive
@@ -1563,6 +1563,7 @@ static void turn_dive_into_trip(GtkTreePath *path)
* it was read from a file */
dive_trip = create_and_hookup_trip_from_dive(dive);
dive_trip->when_from_file = dive_trip->when;
+ free(newiter);
}
/* we know that path is pointing at a dive in a trip and are asked to split this trip into two */
@@ -1605,7 +1606,7 @@ static void insert_trip_before(GtkTreePath *path)
dive->divetrip = new_divetrip;
if (dive->when < dive->divetrip->when)
dive->divetrip->when = dive->when;
- (void) move_dive_between_trips(&nextsibling, &parent, &newparent, NULL, FALSE);
+ free(move_dive_between_trips(&nextsibling, &parent, &newparent, NULL, FALSE));
if (gtk_tree_path_compare(path, treepath) == 0)
/* we copied the dive we were called with; we are done */
break;
@@ -1679,6 +1680,7 @@ static void remove_from_trip(GtkTreePath *path)
#ifdef DEBUG_TRIP
dump_trip_list();
#endif
+ free(newiter);
}
static void remove_rowref_from_trip(gpointer data, gpointer user_data)