mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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)
|
if (!merged)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* careful - we might free the dive that last points to. Oops... */
|
||||||
|
if (last == prev || last == dive)
|
||||||
|
last = merged;
|
||||||
free(prev);
|
free(prev);
|
||||||
free(dive);
|
free(dive);
|
||||||
*pp = merged;
|
*pp = merged;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue