mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:13:24 +00:00
Fix potential crash when importing dives
If the last of the preexisting dives gets merged with a new dive we end up dereferencing a freed pointer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
421366d0fb
commit
fa2f1b6eb0
1 changed files with 3 additions and 0 deletions
3
main.c
3
main.c
|
@ -125,6 +125,9 @@ void report_dives(gboolean is_imported)
|
|||
if (!merged)
|
||||
continue;
|
||||
|
||||
/* careful - we might free the dive that last points to. Oops... */
|
||||
if (last == prev || last == dive)
|
||||
last = merged;
|
||||
free(prev);
|
||||
free(dive);
|
||||
*pp = merged;
|
||||
|
|
Loading…
Add table
Reference in a new issue