[PATCH 1/2] Make 'clear_dive()' free the primary dive computer data properly

Rick Walsh rickmwalsh at gmail.com
Thu Jun 9 16:19:02 PDT 2016


On 1 June 2016 at 03:10, Linus Torvalds <torvalds at linux-foundation.org>

> From: Linus Torvalds <torvalds at linux-foundation.org>
> Date: Mon, 11 Apr 2016 14:25:03 -0700
> Subject: [PATCH 1/2] Make 'clear_dive()' free the primary dive computer
> data properly
> Our primary dive computer really is special, not just because it's the
> first one: it's directly embedded in the "struct dive", and so if you
> just walk the divecomputer list, you'll miss it, because it's not _on_
> the list, it is the very head _of_ the list.
> We had that bug in copy_dive(), and it turns out we have it in
> clear_dive() too: clear_dive() would free all the dive computers on the
> list, but not the actual primary one.
> This is a minor memory leak, no more, so it's not exactly critial, but
> let's just do it right.
> Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
> ---
>  core/dive.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
This change leads to an invalid pointer error when cancelling a planned

*** Error in `/home/rick/src/subsurface/build/subsurface': munmap_chunk():
invalid pointer: 0x0000000000803f5d ***
======= Backtrace: =========

Do you know what the fix could be?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160610/c4cfd5cf/attachment.html>

More information about the subsurface mailing list