aboutsummaryrefslogtreecommitdiffstats
path: root/smtk-import
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2020-04-19 07:54:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-19 10:59:12 -0700
commite139b7b15fbffba6cf302ec49a67239663144a5b (patch)
treefa9ea020e7baea1b9d0bc0198a05bd94b45659ce /smtk-import
parent6c9a9b2fb5ff1d8e3aab9b041617349917ac5061 (diff)
downloadsubsurface-e139b7b15fbffba6cf302ec49a67239663144a5b.tar.gz
[smtk-import] add some sanity checks
Under some circustances values stored in this arrays may be NULL or even previously freed. Check them to avoid further crashes. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Diffstat (limited to 'smtk-import')
-rw-r--r--smtk-import/smartrak.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c
index 8791a5551..c3e4f562e 100644
--- a/smtk-import/smartrak.c
+++ b/smtk-import/smartrak.c
@@ -44,7 +44,8 @@ static void smtk_free(char **array, int count)
{
int n;
for (n = 0; n < count; n++)
- free(array[n]);
+ if (array[n])
+ free(array[n]);
array = NULL;
}
@@ -727,6 +728,8 @@ static void smtk_parse_relations(MdbHandle *mdb, struct dive *dive, char *dive_i
/* Get the text associated with the relations */
for (d_runner = diverel_head; d_runner; d_runner = d_runner->next) {
+ if (! list[d_runner->idx - 1])
+ continue;
if (tag)
taglist_add_tag(&dive->tag_list, list[d_runner->idx - 1]);
else