Data corruption when saving dives in win daily 4.2.-457

Lubomir I. Ivanov neolit123 at
Fri Nov 14 12:46:43 PST 2014

On 14 November 2014 19:57, Tomaz Canabrava <tcanabrava at> wrote:
> Looks like a bug that I should look at. Will see.

hey Tomaz,

i think i was able to find the cause, but the code is confusing me.

void MainTab::acceptChanges()
// copy the cylinder but make sure we have our own copy of the strings
free((void*)cd->cylinder[i].type.description); // <---------------

if the above free() call is removed the memory corruption is gone.

isn't it sufficient for that loop to simply be?:

for (int i = 0; i < MAX_CYLINDERS; i++) {
    cd->cylinder[i] = displayed_dive.cylinder[i];

perhaps i don't understand the difference between 'current_dive' and


More information about the subsurface mailing list