mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
[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>
This commit is contained in:
parent
6c9a9b2fb5
commit
e139b7b15f
1 changed files with 4 additions and 1 deletions
|
@ -44,7 +44,8 @@ static void smtk_free(char **array, int count)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < count; n++)
|
for (n = 0; n < count; n++)
|
||||||
free(array[n]);
|
if (array[n])
|
||||||
|
free(array[n]);
|
||||||
array = NULL;
|
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 */
|
/* Get the text associated with the relations */
|
||||||
for (d_runner = diverel_head; d_runner; d_runner = d_runner->next) {
|
for (d_runner = diverel_head; d_runner; d_runner = d_runner->next) {
|
||||||
|
if (! list[d_runner->idx - 1])
|
||||||
|
continue;
|
||||||
if (tag)
|
if (tag)
|
||||||
taglist_add_tag(&dive->tag_list, list[d_runner->idx - 1]);
|
taglist_add_tag(&dive->tag_list, list[d_runner->idx - 1]);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue