[PATCH 4/4] Fix memory leaks related to dive_trip->location

Dirk Hohndel dirk at hohndel.org
Mon Oct 1 20:24:04 PDT 2012

On Oct 1, 2012, at 4:04 PM, Lubomir I. Ivanov wrote:

> On 2 October 2012 01:52, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>> When creating a new dive_trip from a dive, we should probably
>> always copy the location via strdup(). However we then have to take
>> care of the de-allocation in divelist.c:delete_trip()
>> and gtk-gui.c:file_close().
> i was wondering if this makes any sense to do (e.g. always strdup()),
> since i don't understand very well how the "location" autocomplete
> list works or if its even related to this. but perhaps its better for
> a dive_trip->location not to be the same as a dive->location.

Yes, we definitely want these two locations to be different as the life cycle of the dive and the dive trip are not guaranteed to be the same.


More information about the subsurface mailing list