diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-15 20:47:53 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-17 21:03:30 -0400 |
commit | fa2f1b6eb06e65e6426cc3a488c6cb5c960e7d49 (patch) | |
tree | a7ece3bb4989ae0d95fc35ce68dd94816c12a824 /main.c | |
parent | 421366d0fb52db317276ec404adb0c45cf398f29 (diff) | |
download | subsurface-fa2f1b6eb06e65e6426cc3a488c6cb5c960e7d49.tar.gz |
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>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |